




import math
from itertools import permutations




def        __SCREAMING_SNAKE_CASE (	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        __SCREAMING_SNAKE_CASE (	lowercase_       ,  lowercase_   )							->						bool:

    """simple docstring"""


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

    return False




def        __SCREAMING_SNAKE_CASE (	)							->						Tuple:

    """simple docstring"""


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

    for number in prime_list:
        __UpperCamelCase			=    []

        for prime_member in permutations(list(str(lowercase_   )   )   ):
            __UpperCamelCase			=    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			=    []
    for candidate in candidates:
        __UpperCamelCase			=    len(lowercase_   )
        __UpperCamelCase			=    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			=    True

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

    __UpperCamelCase			=    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    A_ ( _lowerCAmelCase  :       str							):






     """simple docstring"""

     return "".join(chr(ord(_lowerCAmelCase							) + 32							) if '''A''' <= char <= '''Z''' else char for char in word							)


if __name__ == "__main__":
   from doctest import testmod

   testmod()