
"""simple docstring"""






from __future__ import annotations

from collections import Counter






def 		_snake_case			(      lowercase__						:    int						)    ->							list[int]:


			'''simple docstring'''





			lowerCAmelCase_       :List[str]     	=    [True] * n
			lowerCAmelCase_       :Tuple     	=    False
			lowerCAmelCase_       :Tuple     	=    False
			lowerCAmelCase_       :Optional[int]     	=    True

			for i in range(3 ,	int(n**0.5 + 1						) ,	2						):
						lowerCAmelCase_       :Dict     	=    i * 2
						while index < n:
									lowerCAmelCase_       :Optional[int]     	=    False
									lowerCAmelCase_       :Any     	=    index + i

			lowerCAmelCase_       :Union[str, Any]     	=    [2]

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

			return primes






def 		_snake_case			(      lowercase__						:    int						)    ->							list[list[int]]:


			'''simple docstring'''





			lowerCAmelCase_       :Union[str, Any]     	=    str(lowercase__						)
			lowerCAmelCase_       :List[Any]     	=    []
			lowerCAmelCase_       :int     	=    ["""0""", """1""", """2""", """3""", """4""", """5""", """6""", """7""", """8""", """9"""]

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

			return replacements






def 		_snake_case			(      lowercase__						:    int = 8						)    ->							int:


			'''simple docstring'''





			lowerCAmelCase_       :Union[str, Any]     	=    set()

			# Filter primes with less than 3 replaceable digits
			lowerCAmelCase_       :Tuple     	=    {
			    x for x in set(prime_sieve(1_0_0_0_0_0_0						)						) if len(str(lowercase__						)						) - len(set(str(lowercase__						)						)						) >= 3
			}

			for prime in primes:
						if prime in numbers_checked:
									continue

						lowerCAmelCase_       :List[str]     	=    digit_replacements(lowercase__						)

						for family in replacements:
									numbers_checked.update(lowercase__						)
									lowerCAmelCase_       :Any     	=    primes.intersection(lowercase__						)

									if len(lowercase__						) != family_length:
												continue

									return min(lowercase__						)

			return -1


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








"""simple docstring"""






import math






def 		_snake_case			(      lowercase__						:    int						)    ->							int:


			'''simple docstring'''





			return sum(int(lowercase__						) for digit in str(lowercase__						)						)






def 		_snake_case			(      lowercase__						:    int = 3_0						)    ->							int:


			'''simple docstring'''





			lowerCAmelCase_       :Union[str, Any]     	=    []
			for digit in range(2 ,	1_0_0						):
						for power in range(2 ,	1_0_0						):
									lowerCAmelCase_       :Tuple     	=    int(math.pow(lowercase__ ,	lowercase__						)						)
									if digit == digit_sum(lowercase__						):
												digit_to_powers.append(lowercase__						)

			digit_to_powers.sort()
			return digit_to_powers[n - 1]


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






