




'''simple docstring'''






import math
from itertools import permutations




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




def 		a_(			lowerCamelCase ,					lowerCamelCase   )					->bool:






       '''simple docstring'''




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

       return False




def 		a_(			)					->Optional[int]:






       '''simple docstring'''




       lowercase	:		List[str]    =   [n for n in range(1001 ,					1_0000 ,					2   ) if is_prime(lowerCamelCase   )]
       lowercase	:		str    =   []

       for number in prime_list:
              lowercase	:		Dict    =   []

              for prime_member in permutations(list(str(lowerCamelCase   )   )   ):
                     lowercase	:		Dict    =   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   )

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

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

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










'''simple docstring'''






from typing import TYPE_CHECKING

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


lowercase						:   int      						=							{
    '''configuration_xlm_prophetnet''': ['''XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMProphetNetConfig'''],
}

try:
      if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase						:   Any      						=							['''XLMProphetNetTokenizer''']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase						:   Tuple      						=							[
          '''XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''XLMProphetNetDecoder''',
          '''XLMProphetNetEncoder''',
          '''XLMProphetNetForCausalLM''',
          '''XLMProphetNetForConditionalGeneration''',
          '''XLMProphetNetModel''',
          '''XLMProphetNetPreTrainedModel''',
      ]


if TYPE_CHECKING:
      from .configuration_xlm_prophetnet import XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMProphetNetConfig

      try:
            if not is_sentencepiece_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_xlm_prophetnet import XLMProphetNetTokenizer

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_xlm_prophetnet import (
                XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
                XLMProphetNetDecoder,
                XLMProphetNetEncoder,
                XLMProphetNetForCausalLM,
                XLMProphetNetForConditionalGeneration,
                XLMProphetNetModel,
                XLMProphetNetPreTrainedModel,
            )

else:
      import sys

      lowercase						:   Optional[Any]      						=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




