






from __future__ import annotations

from collections import Counter






def        lowerCamelCase__   (					__lowerCamelCase    :  int	):
  __UpperCAmelCase     =						[True] * n
  __UpperCAmelCase     =						False
  __UpperCAmelCase     =						False
  __UpperCAmelCase     =						True

  for i in range(3						,	int(n**0.5 + 1	)						,	2	):
    __UpperCAmelCase     =						i * 2
    while index < n:
      __UpperCAmelCase     =						False
      __UpperCAmelCase     =						index + i

  __UpperCAmelCase     =						[2]

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

  return primes






def        lowerCamelCase__   (					__lowerCamelCase    :  int	):
  __UpperCAmelCase     =						str(__lowerCamelCase	)
  __UpperCAmelCase     =						[]
  __UpperCAmelCase     =						["""0""", """1""", """2""", """3""", """4""", """5""", """6""", """7""", """8""", """9"""]

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

  return replacements






def        lowerCamelCase__   (					__lowerCamelCase    :  int = 8	):
  __UpperCAmelCase     =						set()

  # Filter primes with less than 3 replaceable digits
  __UpperCAmelCase     =						{
      x for x in set(prime_sieve(1000000	)	) if len(str(__lowerCamelCase	)	) - len(set(str(__lowerCamelCase	)	)	) >= 3
  }

  for prime in primes:
    if prime in numbers_checked:
      continue

    __UpperCAmelCase     =						digit_replacements(__lowerCamelCase	)

    for family in replacements:
      numbers_checked.update(__lowerCamelCase	)
      __UpperCAmelCase     =						primes.intersection(__lowerCamelCase	)

      if len(__lowerCamelCase	) != family_length:
        continue

      return min(__lowerCamelCase	)

  return -1


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










from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


a	: str      =				{"configuration_hubert": ["HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "HubertConfig"]}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a	: str      =				[
           "HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
           "HubertForCTC",
           "HubertForSequenceClassification",
           "HubertModel",
           "HubertPreTrainedModel",
       ]


try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a	: List[str]      =				[
           "TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
           "TFHubertForCTC",
           "TFHubertModel",
           "TFHubertPreTrainedModel",
       ]

if TYPE_CHECKING:
       from .configuration_hubert import HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, HubertConfig

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_hubert import (
                  HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  HubertForCTC,
                  HubertForSequenceClassification,
                  HubertModel,
                  HubertPreTrainedModel,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_hubert import (
                  TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TFHubertForCTC,
                  TFHubertModel,
                  TFHubertPreTrainedModel,
              )


else:
       import sys

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


