






'''simple docstring'''







import math
from itertools import permutations


def 						_UpperCamelCase							(     snake_case__							):

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


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

      return False


def 						_UpperCamelCase							(     ):
      __A		   =      [n for n in range(1_001							,			10_000							,			2							) if is_prime(snake_case__							)]
      __A		   =      []

      for number in prime_list:
            __A		   =      []

            for prime_member in permutations(list(str(snake_case__							)							)							):
                  __A		   =      int("".join(snake_case__							)							)

                  if prime % 2 == 0:
                        continue

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

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

      __A		   =      []
      for candidate in candidates:
            __A		   =      len(snake_case__							)
            __A		   =      False

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

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

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

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


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










'''simple docstring'''







import importlib
import sys
from argparse import REMAINDER, ArgumentParser
from pathlib import Path

import torch_xla.distributed.xla_multiprocessing as xmp


def 						_UpperCamelCase							(     ):
      __A		   =      ArgumentParser(
          description=(
              "PyTorch TPU distributed training launch helper utility that will spawn up multiple distributed processes"
          )							)

      # Optional arguments for the launch helper
      parser.add_argument("--num_cores"							,			type=snake_case__							,			default=1							,			help="Number of TPU cores to use (1 or 8)."							)

      # positional
      parser.add_argument(
          "training_script"							,			type=snake_case__							,			help=(
              "The full path to the single TPU training "
              "program/script to be launched in parallel, "
              "followed by all the arguments for the "
              "training script"
          )							,			)

      # rest from the training program
      parser.add_argument("training_script_args"							,			nargs=snake_case__							)

      return parser.parse_args()


def 						_UpperCamelCase							(     ):
      __A		   =      parse_args()

      # Import training_script as a module.
      __A		   =      Path(args.training_script							)
      sys.path.append(str(script_fpath.parent.resolve()							)							)
      __A		   =      script_fpath.stem
      __A		   =      importlib.import_module(snake_case__							)

      # Patch sys.argv
      __A		   =      [args.training_script] + args.training_script_args + ["--tpu_num_cores", str(args.num_cores							)]

      xmp.spawn(mod._mp_fn							,			args=()							,			nprocs=args.num_cores							)


if __name__ == "__main__":
       main()


