






from __future__ import annotations

from collections import Counter






def   a      (						lowerCamelCase_    ):






				'''simple docstring'''
				lowercase__       			=      [True] * n
				lowercase__       			=      False
				lowercase__       			=      False
				lowercase__       			=      True

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

				lowercase__       			=      [2]

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

				return primes






def   a      (						lowerCamelCase_    ):






				'''simple docstring'''
				lowercase__       			=      str(lowerCamelCase_    )
				lowercase__       			=      []
				lowercase__       			=      ['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']

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

				return replacements






def   a      (						lowerCamelCase_ = 8    ):






				'''simple docstring'''
				lowercase__       			=      set()

				# Filter primes with less than 3 replaceable digits
				lowercase__       			=      {
				    x for x in set(prime_sieve(100_0000    )    ) if len(str(lowerCamelCase_    )    ) - len(set(str(lowerCamelCase_    )    )    ) >= 3
				}

				for prime in primes:
								if prime in numbers_checked:
												continue

								lowercase__       			=      digit_replacements(lowerCamelCase_    )

								for family in replacements:
												numbers_checked.update(lowerCamelCase_    )
												lowercase__       			=      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,
    is_vision_available,
)


A__     :      int             =			{
    'configuration_sam': [
        'SAM_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'SamConfig',
        'SamMaskDecoderConfig',
        'SamPromptEncoderConfig',
        'SamVisionConfig',
    ],
    'processing_sam': ['SamProcessor'],
}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      List[Any]             =			[
							    'SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'SamModel',
							    'SamPreTrainedModel',
							]
try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      int             =			[
							    'TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'TFSamModel',
							    'TFSamPreTrainedModel',
							]
try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      Tuple             =			['SamImageProcessor']


if TYPE_CHECKING:
							from .configuration_sam import (
							    SAM_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    SamConfig,
							    SamMaskDecoderConfig,
							    SamPromptEncoderConfig,
							    SamVisionConfig,
							)
							from .processing_sam import SamProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_sam import SAM_PRETRAINED_MODEL_ARCHIVE_LIST, SamModel, SamPreTrainedModel

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_sam import TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST, TFSamModel, TFSamPreTrainedModel

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .image_processing_sam import SamImageProcessor

else:
							import sys

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




