import math
from itertools import permutations


def SCREAMING_SNAKE_CASE			(       lowercase_:		int			):

       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 SCREAMING_SNAKE_CASE			(       lowercase_:		int						,  lowercase_:		list			):
       _UpperCamelCase  , _UpperCamelCase       :    Optional[Any]					  =					0, len(lowercase_			) - 1
       while left <= right:
              _UpperCamelCase       :    Optional[int]					  =					(left + right) // 2
              if prime_list[middle] == target:
                     return True
              elif prime_list[middle] < target:
                     _UpperCamelCase       :    str					  =					middle + 1
              else:
                     _UpperCamelCase       :    Tuple					  =					middle - 1

       return False


def SCREAMING_SNAKE_CASE			(       ):
       _UpperCamelCase       :    str					  =					[n for n in range(1001						,  10000						,  2			) if is_prime(lowercase_			)]
       _UpperCamelCase       :    List[Any]					  =					[]

       for number in prime_list:
              _UpperCamelCase       :    Any					  =					[]

              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       :    List[Any]					  =					[]
       for candidate in candidates:
              _UpperCamelCase       :    Any					  =					len(lowercase_			)
              _UpperCamelCase       :    Union[str, Any]					  =					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       :    List[str]					  =					True

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

       _UpperCamelCase       :    Optional[int]					  =					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())




from typing import TYPE_CHECKING

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


UpperCAmelCase     						=			{
    '''configuration_mpnet''': ['''MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MPNetConfig'''],
    '''tokenization_mpnet''': ['''MPNetTokenizer'''],
}

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase     						=			['''MPNetTokenizerFast''']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase     						=			[
     '''MPNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''MPNetForMaskedLM''',
     '''MPNetForMultipleChoice''',
     '''MPNetForQuestionAnswering''',
     '''MPNetForSequenceClassification''',
     '''MPNetForTokenClassification''',
     '''MPNetLayer''',
     '''MPNetModel''',
     '''MPNetPreTrainedModel''',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase     						=			[
     '''TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''TFMPNetEmbeddings''',
     '''TFMPNetForMaskedLM''',
     '''TFMPNetForMultipleChoice''',
     '''TFMPNetForQuestionAnswering''',
     '''TFMPNetForSequenceClassification''',
     '''TFMPNetForTokenClassification''',
     '''TFMPNetMainLayer''',
     '''TFMPNetModel''',
     '''TFMPNetPreTrainedModel''',
 ]


if TYPE_CHECKING:
 from .configuration_mpnet import MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP, MPNetConfig
 from .tokenization_mpnet import MPNetTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_mpnet_fast import MPNetTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_mpnet import (
      MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
      MPNetForMaskedLM,
      MPNetForMultipleChoice,
      MPNetForQuestionAnswering,
      MPNetForSequenceClassification,
      MPNetForTokenClassification,
      MPNetLayer,
      MPNetModel,
      MPNetPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_mpnet import (
      TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFMPNetEmbeddings,
      TFMPNetForMaskedLM,
      TFMPNetForMultipleChoice,
      TFMPNetForQuestionAnswering,
      TFMPNetForSequenceClassification,
      TFMPNetForTokenClassification,
      TFMPNetMainLayer,
      TFMPNetModel,
      TFMPNetPreTrainedModel,
  )

else:
 import sys

 UpperCAmelCase     						=			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



