


'''simple docstring'''





import random
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():
					import PIL

					from transformers import FlavaImageProcessor
					from transformers.image_utils import PILImageResampling
					from transformers.models.flava.image_processing_flava import (
					    FLAVA_CODEBOOK_MEAN,
					    FLAVA_CODEBOOK_STD,
					    FLAVA_IMAGE_MEAN,
					    FLAVA_IMAGE_STD,
					)
else:
					UpperCamelCase :				Union[str, Any]						    =       None

class     __snake_case							(      unittest.TestCase):
					def __init__(	self					:	Optional[Any]  ,			_lowerCAmelCase					:	Any  ,			_lowerCAmelCase					:	Optional[Any]=7  ,			_lowerCAmelCase					:	Optional[int]=3  ,			_lowerCAmelCase					:	Union[str, Any]=3_0  ,			_lowerCAmelCase					:	Optional[Any]=4_0_0  ,			_lowerCAmelCase					:	Tuple=True  ,			_lowerCAmelCase					:	int=None  ,			_lowerCAmelCase					:	Any=True  ,			_lowerCAmelCase					:	Dict=None  ,			_lowerCAmelCase					:	Optional[int]=None  ,			_lowerCAmelCase					:	List[Any]=True  ,			_lowerCAmelCase					:	Optional[Any]=1 / 2_5_5  ,			_lowerCAmelCase					:	Union[str, Any]=True  ,			_lowerCAmelCase					:	str=FLAVA_IMAGE_MEAN  ,			_lowerCAmelCase					:	Union[str, Any]=FLAVA_IMAGE_STD  ,			_lowerCAmelCase					:	Tuple=1_4  ,			_lowerCAmelCase					:	Union[str, Any]=7_5  ,			_lowerCAmelCase					:	Dict=None  ,			_lowerCAmelCase					:	int=1_6  ,			_lowerCAmelCase					:	List[Any]=0.3  ,			_lowerCAmelCase					:	Dict=None  ,			_lowerCAmelCase					:	Union[str, Any]=True  ,			_lowerCAmelCase					:	Dict=None  ,			_lowerCAmelCase					:	Optional[int]=None  ,			_lowerCAmelCase					:	Any=True  ,			_lowerCAmelCase					:	int=None  ,			_lowerCAmelCase					:	List[Any]=True  ,			_lowerCAmelCase					:	str=True  ,			_lowerCAmelCase					:	Tuple=FLAVA_CODEBOOK_MEAN  ,			_lowerCAmelCase					:	str=FLAVA_CODEBOOK_STD  ,			)       ->				Union[str, Any]:



											'''simple docstring'''





											__magic_name__ 		=			size if size is not None else {'height': 2_2_4, 'width': 2_2_4}
											__magic_name__ 		=			crop_size if crop_size is not None else {'height': 2_2_4, 'width': 2_2_4}
											__magic_name__ 		=			codebook_size if codebook_size is not None else {'height': 1_1_2, 'width': 1_1_2}
											__magic_name__ 		=			codebook_crop_size if codebook_crop_size is not None else {'height': 1_1_2, 'width': 1_1_2}

											__magic_name__ 		=			parent
											__magic_name__ 		=			batch_size
											__magic_name__ 		=			num_channels
											__magic_name__ 		=			do_resize
											__magic_name__ 		=			do_rescale
											__magic_name__ 		=			rescale_factor
											__magic_name__ 		=			min_resolution
											__magic_name__ 		=			max_resolution
											__magic_name__ 		=			size
											__magic_name__ 		=			resample if resample is not None else PILImageResampling.BICUBIC
											__magic_name__ 		=			do_normalize
											__magic_name__ 		=			image_mean
											__magic_name__ 		=			image_std
											__magic_name__ 		=			do_center_crop
											__magic_name__ 		=			crop_size

											__magic_name__ 		=			input_size_patches
											__magic_name__ 		=			total_mask_patches
											__magic_name__ 		=			mask_group_max_patches
											__magic_name__ 		=			mask_group_min_patches
											__magic_name__ 		=			mask_group_min_aspect_ratio
											__magic_name__ 		=			mask_group_max_aspect_ratio

											__magic_name__ 		=			codebook_do_resize
											__magic_name__ 		=			codebook_size
											__magic_name__ 		=			codebook_resample if codebook_resample is not None else PILImageResampling.LANCZOS
											__magic_name__ 		=			codebook_do_center_crop
											__magic_name__ 		=			codebook_crop_size
											__magic_name__ 		=			codebook_do_map_pixels
											__magic_name__ 		=			codebook_do_normalize
											__magic_name__ 		=			codebook_image_mean
											__magic_name__ 		=			codebook_image_std
					def   a (	self					:	Optional[Any]     )       ->				List[Any]:



											'''simple docstring'''





											return {
											    "image_mean": self.image_mean,
											    "image_std": self.image_std,
											    "do_normalize": self.do_normalize,
											    "do_resize": self.do_resize,
											    "size": self.size,
											    "resample": self.resample,
											    "do_rescale": self.do_rescale,
											    "rescale_factor": self.rescale_factor,
											    "do_center_crop": self.do_center_crop,
											    "crop_size": self.crop_size,
											    "input_size_patches": self.input_size_patches,
											    "total_mask_patches": self.total_mask_patches,
											    "mask_group_max_patches": self.mask_group_max_patches,
											    "mask_group_min_patches": self.mask_group_min_patches,
											    "mask_group_min_aspect_ratio": self.mask_group_min_aspect_ratio,
											    "mask_group_max_aspect_ratio": self.mask_group_min_aspect_ratio,
											    "codebook_do_resize": self.codebook_do_resize,
											    "codebook_size": self.codebook_size,
											    "codebook_resample": self.codebook_resample,
											    "codebook_do_center_crop": self.codebook_do_center_crop,
											    "codebook_crop_size": self.codebook_crop_size,
											    "codebook_do_map_pixels": self.codebook_do_map_pixels,
											    "codebook_do_normalize": self.codebook_do_normalize,
											    "codebook_image_mean": self.codebook_image_mean,
											    "codebook_image_std": self.codebook_image_std,
											}
					def   a (	self					:	Optional[int]     )       ->				int:



											'''simple docstring'''





											return (self.size["height"], self.size["width"])
					def   a (	self					:	Union[str, Any]     )       ->				str:



											'''simple docstring'''





											return (
											    (self.input_size_patches, self.input_size_patches)
											    if not isinstance(self.input_size_patches  ,			_lowerCAmelCase     )
											    else self.input_size_patches
											)







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



											'''simple docstring'''





											return (self.codebook_size["height"], self.codebook_size["width"])







@require_torch
@require_vision
class     __snake_case							(      _UpperCAmelCase  ,			unittest.TestCase):
					SCREAMING_SNAKE_CASE_		:					Tuple 				= FlavaImageProcessor if is_vision_available() else None
					SCREAMING_SNAKE_CASE_		:					Union[str, Any] 				= None
					def   a (	self					:	List[Any]     )       ->				Dict:



											'''simple docstring'''





											__magic_name__ 		=			FlavaImageProcessingTester(self     )
					@property
					def   a (	self					:	Dict     )       ->				Union[str, Any]:



											'''simple docstring'''





											return self.image_processor_tester.prepare_image_processor_dict()
					def   a (	self					:	str     )       ->				Optional[int]:



											'''simple docstring'''





											__magic_name__ 		=			self.image_processing_class(**self.image_processor_dict     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'image_mean'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'image_std'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'do_normalize'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'do_resize'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'resample'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'crop_size'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'do_center_crop'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'do_rescale'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'rescale_factor'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'masking_generator'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_do_resize'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_size'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_resample'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_do_center_crop'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_crop_size'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_do_map_pixels'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_do_normalize'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_image_mean'     )     )
											self.assertTrue(hasattr(_lowerCAmelCase  ,			'codebook_image_std'     )     )
					def   a (	self					:	Tuple     )       ->				Dict:



											'''simple docstring'''





											__magic_name__ 		=			self.image_processing_class.from_dict(self.image_processor_dict     )
											self.assertEqual(image_processor.size  ,			{'height': 2_2_4, 'width': 2_2_4}     )
											self.assertEqual(image_processor.crop_size  ,			{'height': 2_2_4, 'width': 2_2_4}     )
											self.assertEqual(image_processor.codebook_size  ,			{'height': 1_1_2, 'width': 1_1_2}     )
											self.assertEqual(image_processor.codebook_crop_size  ,			{'height': 1_1_2, 'width': 1_1_2}     )

											__magic_name__ 		=			self.image_processing_class.from_dict(
											    self.image_processor_dict  ,			size=4_2  ,			crop_size=8_4  ,			codebook_size=3_3  ,			codebook_crop_size=6_6     )
											self.assertEqual(image_processor.size  ,			{'height': 4_2, 'width': 4_2}     )
											self.assertEqual(image_processor.crop_size  ,			{'height': 8_4, 'width': 8_4}     )
											self.assertEqual(image_processor.codebook_size  ,			{'height': 3_3, 'width': 3_3}     )
											self.assertEqual(image_processor.codebook_crop_size  ,			{'height': 6_6, 'width': 6_6}     )
					def   a (	self					:	Optional[int]     )       ->				Union[str, Any]:



											'''simple docstring'''





											pass
					def   a (	self					:	Optional[int]     )       ->				List[Any]:



											'''simple docstring'''





											__magic_name__ 		=			self.image_processing_class(**self.image_processor_dict     )
											# create random PIL images
											__magic_name__ 		=			prepare_image_inputs(self.image_processor_tester  ,			equal_resolution=_lowerCAmelCase     )
											for image in image_inputs:
																	self.assertIsInstance(_lowerCAmelCase  ,			PIL.Image.Image     )

											# Test not batched input
											__magic_name__ 		=			image_processing(image_inputs[0]  ,			return_tensors='pt'     )

											# Test no bool masked pos
											self.assertFalse('bool_masked_pos' in encoded_images     )

											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_image_size()

											self.assertEqual(
											    encoded_images.pixel_values.shape  ,			(1, self.image_processor_tester.num_channels, expected_height, expected_width)  ,			)

											# Test batched
											__magic_name__ 		=			image_processing(_lowerCAmelCase  ,			return_tensors='pt'     )
											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_image_size()

											# Test no bool masked pos
											self.assertFalse('bool_masked_pos' in encoded_images     )

											self.assertEqual(
											    encoded_images.pixel_values.shape  ,			(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        expected_height,
											        expected_width,
											    )  ,			)
					def   a (	self					:	int  ,			_lowerCAmelCase					:	Dict  ,			_lowerCAmelCase					:	Tuple     )       ->				List[Any]:



											'''simple docstring'''





											__magic_name__ 		=			self.image_processing_class(**self.image_processor_dict     )
											# create random tensors
											__magic_name__ 		=			prepare_image_inputs(self.image_processor_tester  ,			equal_resolution=_lowerCAmelCase  ,			**_lowerCAmelCase     )
											for image in image_inputs:
																	self.assertIsInstance(_lowerCAmelCase  ,			_lowerCAmelCase     )

											# Test not batched input
											__magic_name__ 		=			image_processing(image_inputs[0]  ,			return_tensors='pt'     )

											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_image_size()
											self.assertEqual(
											    encoded_images.pixel_values.shape  ,			(1, self.image_processor_tester.num_channels, expected_height, expected_width)  ,			)

											__magic_name__ 		=			image_processing(_lowerCAmelCase  ,			return_image_mask=_lowerCAmelCase  ,			return_tensors='pt'     )

											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_image_size()
											self.assertEqual(
											    encoded_images.pixel_values.shape  ,			(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        expected_height,
											        expected_width,
											    )  ,			)

											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_mask_size()
											self.assertEqual(
											    encoded_images.bool_masked_pos.shape  ,			(
											        self.image_processor_tester.batch_size,
											        expected_height,
											        expected_width,
											    )  ,			)

											# Test batched
											__magic_name__ 		=			image_processing(_lowerCAmelCase  ,			return_tensors='pt'     ).pixel_values

											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_image_size()
											self.assertEqual(
											    encoded_images.shape  ,			(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        expected_height,
											        expected_width,
											    )  ,			)

											# Test masking
											__magic_name__ 		=			image_processing(_lowerCAmelCase  ,			return_image_mask=_lowerCAmelCase  ,			return_tensors='pt'     )

											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_image_size()
											self.assertEqual(
											    encoded_images.pixel_values.shape  ,			(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        expected_height,
											        expected_width,
											    )  ,			)

											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_mask_size()
											self.assertEqual(
											    encoded_images.bool_masked_pos.shape  ,			(
											        self.image_processor_tester.batch_size,
											        expected_height,
											        expected_width,
											    )  ,			)
					def   a (	self					:	List[str]     )       ->				List[str]:



											'''simple docstring'''





											self._test_call_framework(np.ndarray  ,			prepare_kwargs={'numpify': True}     )
					def   a (	self					:	str     )       ->				str:



											'''simple docstring'''





											self._test_call_framework(torch.Tensor  ,			prepare_kwargs={'torchify': True}     )
					def   a (	self					:	Any     )       ->				Union[str, Any]:



											'''simple docstring'''





											random.seed(1_2_3_4     )
											__magic_name__ 		=			self.image_processing_class(**self.image_processor_dict     )
											__magic_name__ 		=			prepare_image_inputs(self.image_processor_tester  ,			equal_resolution=_lowerCAmelCase  ,			torchify=_lowerCAmelCase     )

											# Test not batched input
											__magic_name__ 		=			image_processing(image_inputs[0]  ,			return_image_mask=_lowerCAmelCase  ,			return_tensors='pt'     )
											self.assertEqual(encoded_images.bool_masked_pos.sum().item()  ,			7_5     )







					def   a (	self					:	Dict     )       ->				List[str]:



											'''simple docstring'''





											__magic_name__ 		=			self.image_processing_class(**self.image_processor_dict     )
											# create random PIL images
											__magic_name__ 		=			prepare_image_inputs(self.image_processor_tester  ,			equal_resolution=_lowerCAmelCase     )
											for image in image_inputs:
																	self.assertIsInstance(_lowerCAmelCase  ,			PIL.Image.Image     )

											# Test not batched input
											__magic_name__ 		=			image_processing(image_inputs[0]  ,			return_codebook_pixels=_lowerCAmelCase  ,			return_tensors='pt'     )
											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_codebook_image_size()
											self.assertEqual(
											    encoded_images.codebook_pixel_values.shape  ,			(1, self.image_processor_tester.num_channels, expected_height, expected_width)  ,			)

											# Test batched
											__magic_name__ 		=			image_processing(_lowerCAmelCase  ,			return_codebook_pixels=_lowerCAmelCase  ,			return_tensors='pt'     )
											__magic_name__		,			__magic_name__ 		=			self.image_processor_tester.get_expected_codebook_image_size()
											self.assertEqual(
											    encoded_images.codebook_pixel_values.shape  ,			(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        expected_height,
											        expected_width,
											    )  ,			)





def 							UpperCamelCase_  (				__snake_case			:						int = 1_00     )->      int:




						'''simple docstring'''
						__magic_name__ 		=			1
						__magic_name__ 		=			0
						for i in range(1	,			num + 1     ):
												fact *= i

						for j in str(__snake_case     ):
												result += int(__snake_case     )

						return result


if __name__ == "__main__":
					print(solution(int(input('''Enter the Number: ''').strip())))

