import math
from itertools import permutations






def   __lowerCamelCase	(       lowerCamelCase__		:	Union[str, Any]			):





			'''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(__lowerCAmelCase			) + 1			)     ,       6			):
						if number % i == 0 or number % (i + 2) == 0:
									return False
			return True






def   __lowerCamelCase	(       lowerCamelCase__		:	Optional[int]     ,       lowerCamelCase__		:	List[Any]			):





			'''simple docstring'''




			lowerCamelCase								=     0, len(__lowerCAmelCase			) - 1
			while left <= right:
						lowerCamelCase								=     (left + right) // 2
						if prime_list[middle] == target:
									return True
						elif prime_list[middle] < target:
									lowerCamelCase								=     middle + 1
						else:
									lowerCamelCase								=     middle - 1

			return False






def   __lowerCamelCase	(       ):





			'''simple docstring'''




			lowerCamelCase								=     [n for n in range(1001     ,       10000     ,       2			) if is_prime(__lowerCAmelCase			)]
			lowerCamelCase								=     []

			for number in prime_list:
						lowerCamelCase								=     []

						for prime_member in permutations(list(str(__lowerCAmelCase			)			)			):
									lowerCamelCase								=     int("""""".join(__lowerCAmelCase			)			)

									if prime % 2 == 0:
												continue

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

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

			lowerCamelCase								=     []
			for candidate in candidates:
						lowerCamelCase								=     len(__lowerCAmelCase			)
						lowerCamelCase								=     False

						for i in range(__lowerCAmelCase			):
									for j in range(i + 1     ,       __lowerCAmelCase			):
												for k in range(j + 1     ,       __lowerCAmelCase			):
															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]]			)			)
																		lowerCamelCase								=     True

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

			lowerCamelCase								=     set()
			for seq in passed:
						answer.add("""""".join([str(__lowerCAmelCase			) for i in seq]			)			)

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


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





import abc
import copy
import dataclasses
from dataclasses import dataclass
from typing import ClassVar, Dict, Type, TypeVar

from ..features import Features


UpperCAmelCase      :						List[Any]    =		TypeVar("T", bound="TaskTemplate")







@dataclass(frozen=a_     )
class 					__lowercase					(       abc.ABC     ):



		"""simple docstring"""

		UpperCamelCase    :				str
		UpperCamelCase    :				ClassVar[Features]
		UpperCamelCase    :				ClassVar[Features]







		def 				__A      (   self		,			A  )     ->   T:







					'''simple docstring'''







					return copy.deepcopy(self  )







		@property
		def 				__A      (   self  )     ->   Features:







					'''simple docstring'''







					return Features(**self.input_schema		,			**self.label_schema  )







		@property
		@abc.abstractmethod
		def 				__A      (   self  )     ->   Dict[str, str]:







					'''simple docstring'''







					raise NotImplementedError







		@classmethod
		def 				__A      (   cls		,			A  )     ->   T:







					'''simple docstring'''







					lowerCamelCase								=     {f.name for f in dataclasses.fields(cls  )}
					return cls(**{k: v for k, v in template_dict.items() if k in field_names}  )

