


from collections import namedtuple

snake_case			:      Any 							=   namedtuple('from_to', 'from_ to')

snake_case			:      Dict 							=   {
    'millimeter': 'mm',
    'centimeter': 'cm',
    'meter': 'm',
    'kilometer': 'km',
    'inch': 'in',
    'inche': 'in',  # Trailing 's' has been stripped off
    'feet': 'ft',
    'foot': 'ft',
    'yard': 'yd',
    'mile': 'mi',
}

snake_case			:      str 							=   {
    'mm': from_to(0.0_01, 10_00),
    'cm': from_to(0.01, 1_00),
    'm': from_to(1, 1),
    'km': from_to(10_00, 0.0_01),
    'in': from_to(0.02_54, 39.37_01),
    'ft': from_to(0.30_48, 3.2_80_84),
    'yd': from_to(0.91_44, 1.0_93_61),
    'mi': from_to(16_09.34, 0.0_00_62_13_71),
}


def 				SCREAMING_SNAKE_CASE (     UpperCAmelCase__   ,UpperCAmelCase__   ,UpperCAmelCase__							):

				"""simple docstring"""






				_SCREAMING_SNAKE_CASE      = from_type.lower().rstrip('s'							)
				_SCREAMING_SNAKE_CASE      = TYPE_CONVERSION.get(UpperCAmelCase__   ,UpperCAmelCase__							)
				_SCREAMING_SNAKE_CASE      = to_type.lower().rstrip('s'							)
				_SCREAMING_SNAKE_CASE      = TYPE_CONVERSION.get(UpperCAmelCase__   ,UpperCAmelCase__							)
				if new_from not in METRIC_CONVERSION:
								_SCREAMING_SNAKE_CASE      = (
								    f'''Invalid \'from_type\' value: {from_type!r}.\n'''
								    f'''Conversion abbreviations are: {", ".join(UpperCAmelCase__							)}'''
								)
								raise ValueError(UpperCAmelCase__							)
				if new_to not in METRIC_CONVERSION:
								_SCREAMING_SNAKE_CASE      = (
								    f'''Invalid \'to_type\' value: {to_type!r}.\n'''
								    f'''Conversion abbreviations are: {", ".join(UpperCAmelCase__							)}'''
								)
								raise ValueError(UpperCAmelCase__							)
				return value * METRIC_CONVERSION[new_from].from_ * METRIC_CONVERSION[new_to].to


if __name__ == "__main__":
							import doctest

							doctest.testmod()




from __future__ import annotations

from collections import Counter


def 				SCREAMING_SNAKE_CASE (     UpperCAmelCase__							):

				"""simple docstring"""






				_SCREAMING_SNAKE_CASE      = [True] * n
				_SCREAMING_SNAKE_CASE      = False
				_SCREAMING_SNAKE_CASE      = False
				_SCREAMING_SNAKE_CASE      = True

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

				_SCREAMING_SNAKE_CASE      = [2]

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

				return primes


def 				SCREAMING_SNAKE_CASE (     UpperCAmelCase__							):

				"""simple docstring"""






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

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

				return replacements


def 				SCREAMING_SNAKE_CASE (     UpperCAmelCase__ = 8							):

				"""simple docstring"""






				_SCREAMING_SNAKE_CASE      = set()

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

				for prime in primes:
								if prime in numbers_checked:
												continue

								_SCREAMING_SNAKE_CASE      = digit_replacements(UpperCAmelCase__							)

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

												if len(UpperCAmelCase__							) != family_length:
																continue

												return min(UpperCAmelCase__							)

				return -1


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