



'''simple docstring'''







from __future__ import annotations

from collections import Counter
def 			_lowerCAmelCase(      UpperCAmelCase_      :	int						) ->							list[int]:
							lowerCAmelCase__  =   [True] * n
							lowerCAmelCase__  =   False
							lowerCAmelCase__  =   False
							lowerCAmelCase__  =   True

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

							lowerCAmelCase__  =   [2]

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

							return primes
def 			_lowerCAmelCase(      UpperCAmelCase_      :	int						) ->							list[list[int]]:
							lowerCAmelCase__  =   str(UpperCAmelCase_						)
							lowerCAmelCase__  =   []
							lowerCAmelCase__  =   ["""0""", """1""", """2""", """3""", """4""", """5""", """6""", """7""", """8""", """9"""]

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

							return replacements
def 			_lowerCAmelCase(      UpperCAmelCase_      :	int = 8						) ->							int:
							lowerCAmelCase__  =   set()

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

							for prime in primes:
														if prime in numbers_checked:
																					continue

														lowerCAmelCase__  =   digit_replacements(UpperCAmelCase_						)

														for family in replacements:
																					numbers_checked.update(UpperCAmelCase_						)
																					lowerCAmelCase__  =   primes.intersection(UpperCAmelCase_						)

																					if len(UpperCAmelCase_						) != family_length:
																												continue

																					return min(UpperCAmelCase_						)

							return -1


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










'''simple docstring'''







_UpperCamelCase  						=			{
    "kilogram": 1,
    "gram": pow(10, 3),
    "milligram": pow(10, 6),
    "metric-ton": pow(10, -3),
    "long-ton": 0.0009842073,
    "short-ton": 0.0011023122,
    "pound": 2.2046244202,
    "stone": 0.1574731728,
    "ounce": 35.273990723,
    "carrat": 5000,
    "atomic-mass-unit": 6.0_2213_6652e26,
}

_UpperCamelCase  						=			{
    "kilogram": 1,
    "gram": pow(10, -3),
    "milligram": pow(10, -6),
    "metric-ton": pow(10, 3),
    "long-ton": 1016.04608,
    "short-ton": 907.184,
    "pound": 0.453592,
    "stone": 6.35029,
    "ounce": 0.0283495,
    "carrat": 0.0002,
    "atomic-mass-unit": 1.6_6054_0199e-27,
}
def 			_lowerCAmelCase(      UpperCAmelCase_      :	str					, UpperCAmelCase_      :	str					, UpperCAmelCase_      :	float						) ->							float:
							if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
														lowerCAmelCase__  =   (
														    F'''Invalid \'from_type\' or \'to_type\' value: {from_type!r}, {to_type!r}\n'''
														    F'''Supported values are: {", ".join(UpperCAmelCase_						)}'''
														)
														raise ValueError(UpperCAmelCase_						)
							return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]


if __name__ == "__main__":
		import doctest

		doctest.testmod()





