





"""simple docstring"""


import math
from itertools import permutations




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




def     lowercase__			(    lowercase_						,lowercase_	)    ->						bool:




      """simple docstring"""

      _UpperCamelCase,     _UpperCamelCase					:		Dict  =				0, len(lowercase_	) - 1
      while left <= right:
            _UpperCamelCase					:		Tuple  =				(left + right) // 2
            if prime_list[middle] == target:
                  return True
            elif prime_list[middle] < target:
                  _UpperCamelCase					:		Optional[Any]  =				middle + 1
            else:
                  _UpperCamelCase					:		str  =				middle - 1

      return False




def     lowercase__			(    )    ->						Optional[int]:




      """simple docstring"""

      _UpperCamelCase					:		Union[str, Any]  =				[n for n in range(1_001						,10_000						,2	) if is_prime(lowercase_	)]
      _UpperCamelCase					:		Union[str, Any]  =				[]

      for number in prime_list:
            _UpperCamelCase					:		Tuple  =				[]

            for prime_member in permutations(list(str(lowercase_	)	)	):
                  _UpperCamelCase					:		Optional[Any]  =				int("".join(lowercase_	)	)

                  if prime % 2 == 0:
                        continue

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

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

      _UpperCamelCase					:		Any  =				[]
      for candidate in candidates:
            _UpperCamelCase					:		Optional[int]  =				len(lowercase_	)
            _UpperCamelCase					:		Tuple  =				False

            for i in range(lowercase_	):
                  for j in range(i + 1						,lowercase_	):
                        for k in range(j + 1						,lowercase_	):
                              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]]	)	)
                                    _UpperCamelCase					:		Optional[Any]  =				True

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

      _UpperCamelCase					:		Optional[Any]  =				set()
      for seq in passed:
            answer.add("".join([str(lowercase_	) for i in seq]	)	)

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


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







"""simple docstring"""


def     lowercase__			(    lowercase_	)    ->						str:




      """simple docstring"""

      return " ".join(sorted(set(sentence.split()	)	)	)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
