




'''simple docstring'''





import math
from itertools import permutations





def UpperCAmelCase    (       UpperCAmelCase_						):

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

    return False





def UpperCAmelCase    (       ):
    _a				:							List[str]							       =      [n for n in range(1_001   ,	10_000   ,	2						) if is_prime(UpperCAmelCase_						)]
    _a				:							List[str]							       =      []

    for number in prime_list:
        _a				:							Optional[Any]							       =      []

        for prime_member in permutations(list(str(UpperCAmelCase_						)						)						):
            _a				:							List[Any]							       =      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_						)

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

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

    _a				:							Dict							       =      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 __future__ import annotations

from random import randrange
def 				UpperCAmelCase__		(					_SCREAMING_SNAKE_CASE :						list					)->list:
      if len(_SCREAMING_SNAKE_CASE					) < 2:
            return collection
      _lowerCAmelCase			      =	randrange(len(_SCREAMING_SNAKE_CASE					)					)  # Use random element as pivot
      _lowerCAmelCase			      =	collection[pivot_index]
      _lowerCAmelCase			      =	[]  # All elements greater than pivot
      _lowerCAmelCase			      =	[]  # All elements less than or equal to pivot

      for element in collection[:pivot_index]:
            (greater if element > pivot else lesser).append(_SCREAMING_SNAKE_CASE					)

      for element in collection[pivot_index + 1 :]:
            (greater if element > pivot else lesser).append(_SCREAMING_SNAKE_CASE					)

      return [*quick_sort(_SCREAMING_SNAKE_CASE					), pivot, *quick_sort(_SCREAMING_SNAKE_CASE					)]


if __name__ == "__main__":
    UpperCAmelCase_          =				input("Enter numbers separated by a comma:\n").strip()
    UpperCAmelCase_          =				[int(item) for item in user_input.split(",")]
    print(quick_sort(unsorted))