import math
from itertools import permutations



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



def       __SCREAMING_SNAKE_CASE    (   __UpperCamelCase       :			int					,	__UpperCamelCase       :			list      )				->   bool:







  """simple docstring"""





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

  return False



def       __SCREAMING_SNAKE_CASE    (   )				->   List[str]:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__     				= [n for n in range(10_01					,	1_00_00					,	2      ) if is_prime(__UpperCamelCase      )]
  SCREAMING_SNAKE_CASE__     				= []

  for number in prime_list:
    SCREAMING_SNAKE_CASE__     				= []

    for prime_member in permutations(list(str(__UpperCamelCase      )      )      ):
      SCREAMING_SNAKE_CASE__     				= int("""""".join(__UpperCamelCase      )      )

      if prime % 2 == 0:
        continue

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

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

  SCREAMING_SNAKE_CASE__     				= []
  for candidate in candidates:
    SCREAMING_SNAKE_CASE__     				= len(__UpperCamelCase      )
    SCREAMING_SNAKE_CASE__     				= False

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

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

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

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


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

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


__lowerCamelCase     :					Optional[int]				  =						{'''configuration_vilt''': ['''VILT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViltConfig''']}

try:
   if not is_vision_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __lowerCamelCase     :					Dict				  =						['''ViltFeatureExtractor''']
   __lowerCamelCase     :					Dict				  =						['''ViltImageProcessor''']
   __lowerCamelCase     :					str				  =						['''ViltProcessor''']

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __lowerCamelCase     :					Any				  =						[
       '''VILT_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''ViltForImageAndTextRetrieval''',
       '''ViltForImagesAndTextClassification''',
       '''ViltForTokenClassification''',
       '''ViltForMaskedLM''',
       '''ViltForQuestionAnswering''',
       '''ViltLayer''',
       '''ViltModel''',
       '''ViltPreTrainedModel''',
   ]


if TYPE_CHECKING:
   from .configuration_vilt import VILT_PRETRAINED_CONFIG_ARCHIVE_MAP, ViltConfig

   try:
      if not is_vision_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .feature_extraction_vilt import ViltFeatureExtractor
      from .image_processing_vilt import ViltImageProcessor
      from .processing_vilt import ViltProcessor

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_vilt import (
          VILT_PRETRAINED_MODEL_ARCHIVE_LIST,
          ViltForImageAndTextRetrieval,
          ViltForImagesAndTextClassification,
          ViltForMaskedLM,
          ViltForQuestionAnswering,
          ViltForTokenClassification,
          ViltLayer,
          ViltModel,
          ViltPreTrainedModel,
      )


else:
   import sys

   __lowerCamelCase     :					List[str]				  =						_LazyModule(__name__, globals()['''__file__'''], _import_structure)
