




from __future__ import annotations

from collections import Counter



def 					lowerCamelCase__							(			__lowercase							):
     snake_case :			List[str]					   = [True] * n
     snake_case :			int					   = False
     snake_case :			List[str]					   = False
     snake_case :			Optional[Any]					   = True

     for i in range(3    ,      int(n**0.5 + 1							)    ,      2							):
          snake_case :			List[Any]					   = i * 2
          while index < n:
               snake_case :			Dict					   = False
               snake_case :			Union[str, Any]					   = index + i

     snake_case :			str					   = [2]

     for i in range(3    ,      __lowercase    ,      2							):
          if is_prime[i]:
               primes.append(__lowercase							)

     return primes



def 					lowerCamelCase__							(			__lowercase							):
     snake_case :			List[Any]					   = str(__lowercase							)
     snake_case :			str					   = []
     snake_case :			Any					   = ["""0""", """1""", """2""", """3""", """4""", """5""", """6""", """7""", """8""", """9"""]

     for duplicate in Counter(__lowercase							) - Counter(set(__lowercase							)							):
          snake_case :			Dict					   = [int(number_str.replace(__lowercase    ,      __lowercase							)							) for digit in digits]
          replacements.append(__lowercase							)

     return replacements



def 					lowerCamelCase__							(			__lowercase = 8							):
     snake_case :			int					   = set()

     # Filter primes with less than 3 replaceable digits
     snake_case :			int					   = {
         x for x in set(prime_sieve(1_000_000							)							) if len(str(__lowercase							)							) - len(set(str(__lowercase							)							)							) >= 3
     }

     for prime in primes:
          if prime in numbers_checked:
               continue

          snake_case :			Optional[int]					   = digit_replacements(__lowercase							)

          for family in replacements:
               numbers_checked.update(__lowercase							)
               snake_case :			Union[str, Any]					   = primes.intersection(__lowercase							)

               if len(__lowercase							) != family_length:
                    continue

               return min(__lowercase							)

     return -1


if __name__ == "__main__":
      print(solution())









'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowercase			:      Any			=					{"""configuration_visual_bert""": ["""VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VisualBertConfig"""]}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase			:      Optional[int]			=					[
          """VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """VisualBertForMultipleChoice""",
          """VisualBertForPreTraining""",
          """VisualBertForQuestionAnswering""",
          """VisualBertForRegionToPhraseAlignment""",
          """VisualBertForVisualReasoning""",
          """VisualBertLayer""",
          """VisualBertModel""",
          """VisualBertPreTrainedModel""",
      ]


if TYPE_CHECKING:
      from .configuration_visual_bert import VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, VisualBertConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_visual_bert import (
                VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
                VisualBertForMultipleChoice,
                VisualBertForPreTraining,
                VisualBertForQuestionAnswering,
                VisualBertForRegionToPhraseAlignment,
                VisualBertForVisualReasoning,
                VisualBertLayer,
                VisualBertModel,
                VisualBertPreTrainedModel,
            )


else:
      import sys

      lowercase			:      List[Any]			=					_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



