


import math
from itertools import permutations






def   __lowerCamelCase	(       lowerCamelCase__		:	int			):





			'''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__		:	int     ,       lowerCamelCase__		:	list			):





			'''simple docstring'''




			lowerCamelCase		,		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())





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


UpperCAmelCase      :						List[str]    =		{
    "configuration_big_bird": ["BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdConfig", "BigBirdOnnxConfig"],
}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase      :						str    =		["BigBirdTokenizer"]

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase      :						str    =		["BigBirdTokenizerFast"]

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase      :						Dict    =		[
		    "BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST",
		    "BigBirdForCausalLM",
		    "BigBirdForMaskedLM",
		    "BigBirdForMultipleChoice",
		    "BigBirdForPreTraining",
		    "BigBirdForQuestionAnswering",
		    "BigBirdForSequenceClassification",
		    "BigBirdForTokenClassification",
		    "BigBirdLayer",
		    "BigBirdModel",
		    "BigBirdPreTrainedModel",
		    "load_tf_weights_in_big_bird",
		]

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase      :						Dict    =		[
		    "FlaxBigBirdForCausalLM",
		    "FlaxBigBirdForMaskedLM",
		    "FlaxBigBirdForMultipleChoice",
		    "FlaxBigBirdForPreTraining",
		    "FlaxBigBirdForQuestionAnswering",
		    "FlaxBigBirdForSequenceClassification",
		    "FlaxBigBirdForTokenClassification",
		    "FlaxBigBirdModel",
		    "FlaxBigBirdPreTrainedModel",
		]

if TYPE_CHECKING:
		from .configuration_big_bird import BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP, BigBirdConfig, BigBirdOnnxConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_big_bird import BigBirdTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_big_bird_fast import BigBirdTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_big_bird import (
				    BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST,
				    BigBirdForCausalLM,
				    BigBirdForMaskedLM,
				    BigBirdForMultipleChoice,
				    BigBirdForPreTraining,
				    BigBirdForQuestionAnswering,
				    BigBirdForSequenceClassification,
				    BigBirdForTokenClassification,
				    BigBirdLayer,
				    BigBirdModel,
				    BigBirdPreTrainedModel,
				    load_tf_weights_in_big_bird,
				)

		try:
				if not is_flax_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_flax_big_bird import (
				    FlaxBigBirdForCausalLM,
				    FlaxBigBirdForMaskedLM,
				    FlaxBigBirdForMultipleChoice,
				    FlaxBigBirdForPreTraining,
				    FlaxBigBirdForQuestionAnswering,
				    FlaxBigBirdForSequenceClassification,
				    FlaxBigBirdForTokenClassification,
				    FlaxBigBirdModel,
				    FlaxBigBirdPreTrainedModel,
				)

else:
		import sys

		UpperCAmelCase      :						Dict    =		_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)

