






"""simple docstring"""


import math
from itertools import permutations


def 					UpperCAmelCase			(				a__   ):





						'''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 					UpperCAmelCase			(				a__    ,			a__   ):





						'''simple docstring'''






						lowerCAmelCase  ,   lowerCAmelCase      :Union[str, Any]				  = 0, len(a__   ) - 1
						while left <= right:
												lowerCAmelCase      :List[Any]				  = (left + right) // 2
												if prime_list[middle] == target:
																		return True
												elif prime_list[middle] < target:
																		lowerCAmelCase      :Any				  = middle + 1
												else:
																		lowerCAmelCase      :Any				  = middle - 1

						return False


def 					UpperCAmelCase			(				):





						'''simple docstring'''






						lowerCAmelCase      :str				  = [n for n in range(10_01    ,			1_00_00    ,			2   ) if is_prime(a__   )]
						lowerCAmelCase      :Dict				  = []

						for number in prime_list:
												lowerCAmelCase      :str				  = []

												for prime_member in permutations(list(str(a__   )   )   ):
																		lowerCAmelCase      :List[Any]				  = 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__   )

						lowerCAmelCase      :Optional[Any]				  = []
						for candidate in candidates:
												lowerCAmelCase      :Optional[Any]				  = len(a__   )
												lowerCAmelCase      :Optional[int]				  = 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]]   )   )
																																				lowerCAmelCase      :Optional[Any]				  = True

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

						lowerCAmelCase      :Tuple				  = 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())







"""simple docstring"""


import unittest
import warnings
from dataclasses import dataclass

from transformers.convert_slow_tokenizer import SpmConverter
from transformers.testing_utils import get_tests_dir




@dataclass
class 	__UpperCamelCase    :
					lowercase_						:							str




class 	__UpperCamelCase    (    unittest.TestCase	):
					def 					UpperCAmelCase__   (       self       :  Union[str, Any]      )  ->					Optional[Any]:
											lowerCAmelCase      :List[str]				  = get_tests_dir('fixtures/test_sentencepiece.model'      )
											lowerCAmelCase      :Tuple				  = get_tests_dir('fixtures/test_sentencepiece_with_bytefallback.model'      )

											lowerCAmelCase      :List[str]				  = FakeOriginalTokenizer(vocab_file=UpperCAmelCase      )

											with warnings.catch_warnings(record=UpperCAmelCase      ) as w:
																	lowerCAmelCase      :Dict				  = SpmConverter(UpperCAmelCase      )
											self.assertEqual(len(UpperCAmelCase      )    ,   0      )

											lowerCAmelCase      :int				  = FakeOriginalTokenizer(vocab_file=UpperCAmelCase      )

											with warnings.catch_warnings(record=UpperCAmelCase      ) as w:
																	lowerCAmelCase      :List[str]				  = SpmConverter(UpperCAmelCase      )
											self.assertEqual(len(UpperCAmelCase      )    ,   1      )

											self.assertIn(
											    'The sentencepiece tokenizer that you are converting to a fast tokenizer uses the byte fallback option'
											    ' which is not implemented in the fast tokenizers.'    ,   str(w[0].message      )    ,   )