'''simple docstring'''


import math
from itertools import permutations


def    _lowerCamelCase       ( lowerCamelCase_   :				int  ):



     """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    _lowerCamelCase       ( lowerCamelCase_   :				int      ,	lowerCamelCase_   :				list  ):



     """simple docstring"""





     UpperCAmelCase_  ,     UpperCAmelCase_				:  Optional[Any]  = 0, len(lowerCamelCase_  ) - 1
     while left <= right:
          UpperCAmelCase_				:  Dict  = (left + right) // 2
          if prime_list[middle] == target:
               return True
          elif prime_list[middle] < target:
               UpperCAmelCase_				:  int  = middle + 1
          else:
               UpperCAmelCase_				:  int  = middle - 1

     return False


def    _lowerCamelCase       ( ):



     """simple docstring"""





     UpperCAmelCase_				:  Dict  = [n for n in range(1001      ,	10000      ,	2  ) if is_prime(lowerCamelCase_  )]
     UpperCAmelCase_				:  Tuple  = []

     for number in prime_list:
          UpperCAmelCase_				:  Tuple  = []

          for prime_member in permutations(list(str(lowerCamelCase_  )  )  ):
               UpperCAmelCase_				:  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_  )

     UpperCAmelCase_				:  Optional[Any]  = []
     for candidate in candidates:
          UpperCAmelCase_				:  Any  = len(lowerCamelCase_  )
          UpperCAmelCase_				:  Tuple  = 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]]  )  )
                              UpperCAmelCase_				:  Tuple  = True

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

     UpperCAmelCase_				:  Dict  = 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())









import unittest

import numpy as np
import PIL
import torch

from diffusers.image_processor import VaeImageProcessor







class 		__magic_name__     (				unittest.TestCase				):

   '''simple docstring'''




   @property
   def 					_UpperCAmelCase					(							self			)				->       Tuple:






     """simple docstring"""






     a__    =1
     a__    =3
     a__    =8
     a__    =8

     a__    =torch.rand((batch_size, num_channels, height, width)			)

     return sample



   def 					_UpperCAmelCase					(							self,       lowercase_			)				->       int:






     """simple docstring"""






     if isinstance(image[0],       PIL.Image.Image			):
       return np.stack([np.array(lowercase_			) for i in image],       axis=0			)
     elif isinstance(lowercase_,       torch.Tensor			):
       return image.cpu().numpy().transpose(0,       2,       3,       1			)
     return image



   def 					_UpperCAmelCase					(							self			)				->       int:






     """simple docstring"""






     a__    =VaeImageProcessor(do_resize=lowercase_,       do_normalize=lowercase_			)

     a__    =self.dummy_sample
     a__    =self.to_np(lowercase_			)

     for output_type in ["pt", "np", "pil"]:
       a__    =image_processor.postprocess(
           image_processor.preprocess(lowercase_			),       output_type=lowercase_,       )
       a__    =self.to_np(lowercase_			)
       a__    =(input_np * 255).round() if output_type == '''pil''' else input_np
       assert (
           np.abs(in_np - out_np			).max() < 1E-6
       ), F"""decoded output does not match input for output_type {output_type}"""



   def 					_UpperCAmelCase					(							self			)				->       List[Any]:






     """simple docstring"""






     a__    =VaeImageProcessor(do_resize=lowercase_,       do_normalize=lowercase_			)
     a__    =self.dummy_sample.cpu().numpy().transpose(0,       2,       3,       1			)

     for output_type in ["pt", "np", "pil"]:
       a__    =image_processor.postprocess(image_processor.preprocess(lowercase_			),       output_type=lowercase_			)

       a__    =self.to_np(lowercase_			)
       a__    =(input_np * 255).round() if output_type == '''pil''' else input_np
       assert (
           np.abs(in_np - out_np			).max() < 1E-6
       ), F"""decoded output does not match input for output_type {output_type}"""



   def 					_UpperCAmelCase					(							self			)				->       Optional[Any]:






     """simple docstring"""






     a__    =VaeImageProcessor(do_resize=lowercase_,       do_normalize=lowercase_			)

     a__    =self.dummy_sample.cpu().numpy().transpose(0,       2,       3,       1			)
     a__    =image_processor.numpy_to_pil(lowercase_			)

     for output_type in ["pt", "np", "pil"]:
       a__    =image_processor.postprocess(image_processor.preprocess(lowercase_			),       output_type=lowercase_			)
       for i, o in zip(lowercase_,       lowercase_			):
         a__    =np.array(lowercase_			)
         a__    =self.to_np(lowercase_			) if output_type == '''pil''' else (self.to_np(lowercase_			) * 255).round()
         assert (
             np.abs(in_np - out_np			).max() < 1E-6
         ), F"""decoded output does not match input for output_type {output_type}"""



   def 					_UpperCAmelCase					(							self			)				->       Union[str, Any]:






     """simple docstring"""






     a__    =VaeImageProcessor(do_resize=lowercase_,       do_normalize=lowercase_			)

     a__    =self.dummy_sample
     a__    =input_pt_ad.squeeze(0			)

     a__    =image_processor.postprocess(
         image_processor.preprocess(lowercase_			),       output_type='''np''',       )
     a__    =image_processor.postprocess(
         image_processor.preprocess(lowercase_			),       output_type='''np''',       )

     a__    =self.to_np(self.dummy_sample			)
     a__    =input_np_ad.squeeze(0			)

     a__    =image_processor.postprocess(
         image_processor.preprocess(lowercase_			),       output_type='''np''',       )
     a__    =image_processor.postprocess(
         image_processor.preprocess(lowercase_			),       output_type='''np''',       )

     assert np.abs(out_pt_ad - out_pt_ad			).max() < 1E-6
     assert np.abs(out_np_ad - out_np_ad			).max() < 1E-6



   def 					_UpperCAmelCase					(							self			)				->       List[Any]:






     """simple docstring"""






     a__    =VaeImageProcessor(do_resize=lowercase_,       do_normalize=lowercase_			)

     a__    =self.dummy_sample
     a__    =list(lowercase_			)

     a__    =image_processor.postprocess(
         image_processor.preprocess(lowercase_			),       output_type='''np''',       )

     a__    =image_processor.postprocess(
         image_processor.preprocess(lowercase_			),       output_type='''np''',       )

     a__    =self.to_np(self.dummy_sample			)
     list(lowercase_			)

     a__    =image_processor.postprocess(
         image_processor.preprocess(lowercase_			),       output_type='''np''',       )

     a__    =image_processor.postprocess(
         image_processor.preprocess(lowercase_			),       output_type='''np''',       )

     assert np.abs(out_pt_ad - out_pt_list			).max() < 1E-6
     assert np.abs(out_np_ad - out_np_list			).max() < 1E-6
