



from __future__ import annotations

from collections import Counter


def 						UpperCAmelCase__   (   UpperCAmelCase__			:int       ):






 '''simple docstring'''

 a							=		[True] * n
 a							=		False
 a							=		False
 a							=		True

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

 a							=		[2]

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

 return primes


def 						UpperCAmelCase__   (   UpperCAmelCase__			:int       ):






 '''simple docstring'''

 a							=		str(UpperCAmelCase__       )
 a							=		[]
 a							=		["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

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

 return replacements


def 						UpperCAmelCase__   (   UpperCAmelCase__			:int = 8       ):






 '''simple docstring'''

 a							=		set()

 # Filter primes with less than 3 replaceable digits
 a							=		{
     x for x in set(prime_sieve(1_00_00_00       )       ) if len(str(UpperCAmelCase__       )       ) - len(set(str(UpperCAmelCase__       )       )       ) >= 3
 }

 for prime in primes:
  if prime in numbers_checked:
   continue

  a							=		digit_replacements(UpperCAmelCase__       )

  for family in replacements:
   numbers_checked.update(UpperCAmelCase__       )
   a							=		primes.intersection(UpperCAmelCase__       )

   if len(UpperCAmelCase__       ) != family_length:
    continue

   return min(UpperCAmelCase__       )

 return -1


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






from typing import TYPE_CHECKING

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


A_		:  Any										=  {
    '''configuration_videomae''': ['''VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VideoMAEConfig'''],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A_		:  List[Any]										=  [
         '''VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''VideoMAEForPreTraining''',
         '''VideoMAEModel''',
         '''VideoMAEPreTrainedModel''',
         '''VideoMAEForVideoClassification''',
     ]

try:
     if not is_vision_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A_		:  str										=  ['''VideoMAEFeatureExtractor''']
     A_		:  Union[str, Any]										=  ['''VideoMAEImageProcessor''']

if TYPE_CHECKING:
     from .configuration_videomae import VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP, VideoMAEConfig

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_videomae import (
              VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST,
              VideoMAEForPreTraining,
              VideoMAEForVideoClassification,
              VideoMAEModel,
              VideoMAEPreTrainedModel,
          )

     try:
          if not is_vision_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .feature_extraction_videomae import VideoMAEFeatureExtractor
          from .image_processing_videomae import VideoMAEImageProcessor

else:
     import sys

     A_		:  Dict										=  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

