import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
 import torch

if is_vision_available():
 from PIL import Image

 from transformers import MobileNetVaImageProcessor

class 				_lowercase						(    unittest.TestCase ):






    '''simple docstring'''




    def __init__(						self					,	lowerCamelCase__					,	lowerCamelCase__=7					,	lowerCamelCase__=3					,	lowerCamelCase__=18					,	lowerCamelCase__=30					,	lowerCamelCase__=400					,	lowerCamelCase__=True					,	lowerCamelCase__=None					,	lowerCamelCase__=True					,	lowerCamelCase__=None					,	):
       lowerCAmelCase_:       List[Any]         =  size if size is not None else {"shortest_edge": 20}
       lowerCAmelCase_:       Tuple         =  crop_size if crop_size is not None else {"height": 18, "width": 18}
       lowerCAmelCase_:       Optional[Any]         =  parent
       lowerCAmelCase_:       int         =  batch_size
       lowerCAmelCase_:       List[str]         =  num_channels
       lowerCAmelCase_:       Any         =  image_size
       lowerCAmelCase_:       List[str]         =  min_resolution
       lowerCAmelCase_:       List[Any]         =  max_resolution
       lowerCAmelCase_:       Any         =  do_resize
       lowerCAmelCase_:       List[str]         =  size
       lowerCAmelCase_:       Tuple         =  do_center_crop
       lowerCAmelCase_:       List[str]         =  crop_size




    def     _a						(						self   ):
       return {
           "do_resize": self.do_resize,
           "size": self.size,
           "do_center_crop": self.do_center_crop,
           "crop_size": self.crop_size,
       }





@require_torch
@require_vision
class 				_lowercase						(    UpperCAmelCase__   ,     unittest.TestCase ):






    '''simple docstring'''
    SCREAMING_SNAKE_CASE:							str        =						MobileNetVaImageProcessor if is_vision_available() else None




    def     _a						(						self   ):
       lowerCAmelCase_:       Optional[Any]         =  MobileNetVaImageProcessingTester(self   )




    @property
    def     _a						(						self   ):
       return self.image_processor_tester.prepare_image_processor_dict()




    def     _a						(						self   ):
       lowerCAmelCase_:       Union[str, Any]         =  self.image_processing_class(**self.image_processor_dict   )
       self.assertTrue(hasattr(lowerCamelCase__					,	"do_resize"   )   )
       self.assertTrue(hasattr(lowerCamelCase__					,	"size"   )   )
       self.assertTrue(hasattr(lowerCamelCase__					,	"do_center_crop"   )   )
       self.assertTrue(hasattr(lowerCamelCase__					,	"center_crop"   )   )




    def     _a						(						self   ):
       lowerCAmelCase_:       Dict         =  self.image_processing_class.from_dict(self.image_processor_dict   )
       self.assertEqual(image_processor.size					,	{"shortest_edge": 20}   )
       self.assertEqual(image_processor.crop_size					,	{"height": 18, "width": 18}   )

       lowerCAmelCase_:       List[Any]         =  self.image_processing_class.from_dict(self.image_processor_dict					,	size=42					,	crop_size=84   )
       self.assertEqual(image_processor.size					,	{"shortest_edge": 42}   )
       self.assertEqual(image_processor.crop_size					,	{"height": 84, "width": 84}   )




    def     _a						(						self   ):
       pass




    def     _a						(						self   ):
       # Initialize image_processing
       lowerCAmelCase_:       Dict         =  self.image_processing_class(**self.image_processor_dict   )
       # create random PIL images
       lowerCAmelCase_:       Optional[int]         =  prepare_image_inputs(self.image_processor_tester					,	equal_resolution=lowerCamelCase__   )
       for image in image_inputs:
          self.assertIsInstance(lowerCamelCase__					,	Image.Image   )

       # Test not batched input
       lowerCAmelCase_:       Tuple         =  image_processing(image_inputs[0]					,	return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape					,	(
               1,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )					,	)

       # Test batched
       lowerCAmelCase_:       str         =  image_processing(lowerCamelCase__					,	return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape					,	(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )					,	)




    def     _a						(						self   ):
       # Initialize image_processing
       lowerCAmelCase_:       Optional[int]         =  self.image_processing_class(**self.image_processor_dict   )
       # create random numpy tensors
       lowerCAmelCase_:       List[str]         =  prepare_image_inputs(self.image_processor_tester					,	equal_resolution=lowerCamelCase__					,	numpify=lowerCamelCase__   )
       for image in image_inputs:
          self.assertIsInstance(lowerCamelCase__					,	np.ndarray   )

       # Test not batched input
       lowerCAmelCase_:       List[str]         =  image_processing(image_inputs[0]					,	return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape					,	(
               1,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )					,	)

       # Test batched
       lowerCAmelCase_:       Union[str, Any]         =  image_processing(lowerCamelCase__					,	return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape					,	(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )					,	)




    def     _a						(						self   ):
       # Initialize image_processing
       lowerCAmelCase_:       List[str]         =  self.image_processing_class(**self.image_processor_dict   )
       # create random PyTorch tensors
       lowerCAmelCase_:       Union[str, Any]         =  prepare_image_inputs(self.image_processor_tester					,	equal_resolution=lowerCamelCase__					,	torchify=lowerCamelCase__   )
       for image in image_inputs:
          self.assertIsInstance(lowerCamelCase__					,	torch.Tensor   )

       # Test not batched input
       lowerCAmelCase_:       Any         =  image_processing(image_inputs[0]					,	return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape					,	(
               1,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )					,	)

       # Test batched
       lowerCAmelCase_:       str         =  image_processing(lowerCamelCase__					,	return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape					,	(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )					,	)
import itertools
def 		snake_case__  (		lowercase				):
   return (
       int("".join(combination[0:2]				)				) * int("".join(combination[2:5]				)				)
       == int("".join(combination[5:9]				)				)
   ) or (
       int("".join(combination[0]				)				) * int("".join(combination[1:5]				)				)
       == int("".join(combination[5:9]				)				)
   )
def 		snake_case__  (		):
   return sum(
       {
           int("".join(pandigital[5:9]				)				)
           for pandigital in itertools.permutations("123456789"				)
           if is_combination_valid(lowercase				)
       }				)


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