






import math
from itertools import permutations
def        a_	( _A					)     ->     bool:







				"""simple docstring"""

				if 1 < number < 4:
								# 2 and 3 are primes
								return True
				elif number < 2 or number % 2 == 0 or number % 3 == 0:
								# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
								return False

				# All primes number are in format of 6k +/- 1
				for i in range(5 ,				int(math.sqrt(_A					) + 1					) ,				6					):
								if number % i == 0 or number % (i + 2) == 0:
												return False
				return True
def        a_	( _A ,				_A					)     ->     bool:







				"""simple docstring"""
				snake_case__							,  snake_case__													=       0, len(_A					) - 1
				while left <= right:
								snake_case__													=       (left + right) // 2
								if prime_list[middle] == target:
												return True
								elif prime_list[middle] < target:
												snake_case__													=       middle + 1
								else:
												snake_case__													=       middle - 1

				return False
def        a_	( )     ->     str:







				"""simple docstring"""
				snake_case__													=       [n for n in range(1001 ,				10000 ,				2					) if is_prime(_A					)]
				snake_case__													=       []

				for number in prime_list:
								snake_case__													=       []

								for prime_member in permutations(list(str(_A					)					)					):
												snake_case__													=       int(''.join(_A					)					)

												if prime % 2 == 0:
																continue

												if search(_A ,				_A					):
																tmp_numbers.append(_A					)

								tmp_numbers.sort()
								if len(_A					) >= 3:
												candidates.append(_A					)

				snake_case__													=       []
				for candidate in candidates:
								snake_case__													=       len(_A					)
								snake_case__													=       False

								for i in range(_A					):
												for j in range(i + 1 ,				_A					):
																for k in range(j + 1 ,				_A					):
																				if (
																				    abs(candidate[i] - candidate[j]					)
																				    == abs(candidate[j] - candidate[k]					)
																				    and len({candidate[i], candidate[j], candidate[k]}					) == 3
																				):
																								passed.append(
																								    sorted([candidate[i], candidate[j], candidate[k]]					)					)
																								snake_case__													=       True

																				if found:
																								break
																if found:
																				break
												if found:
																break

				snake_case__													=       set()
				for seq in passed:
								answer.add(''.join([str(_A					) for i in seq]					)					)

				return max(int(_A					) for x in answer					)


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












def        a_	( _A ,				_A					)     ->     Union[str, Any]:







				"""simple docstring"""
				snake_case__													=       1
				while b > 0:
								if b & 1:
												res *= a

								a *= a
								b >>= 1

				return res
def        a_	( _A ,				_A ,				_A					)     ->     Dict:







				"""simple docstring"""
				snake_case__													=       1
				while b > 0:
								if b & 1:
												snake_case__													=       ((res % c) * (a % c)) % c

								a *= a
								b >>= 1

				return res




