

from typing import Dict, List, Optional, Union

import numpy as np

from transformers.utils import is_vision_available
from transformers.utils.generic import TensorType

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    is_valid_image,
    to_numpy_array,
    valid_images,
)
from ...utils import logging


if is_vision_available():
	import PIL

lowerCAmelCase__	   = logging.get_logger(__name__)



def 					lowerCAmelCase__							(	SCREAMING_SNAKE_CASE_:							Tuple      )			->      List[List[ImageInput]]:




				'''simple docstring'''





				if isinstance(SCREAMING_SNAKE_CASE_	,       (list, tuple)      ) and isinstance(videos[0]	,       (list, tuple)      ) and is_valid_image(videos[0][0]      ):
								return videos

				elif isinstance(SCREAMING_SNAKE_CASE_	,       (list, tuple)      ) and is_valid_image(videos[0]      ):
								return [videos]

				elif is_valid_image(SCREAMING_SNAKE_CASE_      ):
								return [[videos]]

				raise ValueError(F'Could not make batched video from {videos}'      )





class 					a__						(					snake_case			):
			"""simple docstring"""







			__lowerCamelCase        =       ['pixel_values']


			def __init__(    self      ,      lowercase = True      ,      lowercase = None      ,      lowercase = PILImageResampling.BILINEAR      ,      lowercase = True      ,      lowercase = None      ,      lowercase = True      ,      lowercase = 1 / 255      ,      lowercase = True      ,      lowercase = True      ,      lowercase = None      ,      lowercase = None      ,      **lowercase      ,      )  ->						None:
							'''simple docstring'''






							super().__init__(**lowercase       )
							A__        =			size if size is not None else {"shortest_edge": 256}
							A__        =			get_size_dict(lowercase      ,      default_to_square=lowercase       )
							A__        =			crop_size if crop_size is not None else {"height": 224, "width": 224}
							A__        =			get_size_dict(lowercase      ,      param_name="crop_size"       )

							A__        =			do_resize
							A__        =			size
							A__        =			do_center_crop
							A__        =			crop_size
							A__        =			resample
							A__        =			do_rescale
							A__        =			rescale_factor
							A__        =			offset
							A__        =			do_normalize
							A__        =			image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
							A__        =			image_std if image_std is not None else IMAGENET_STANDARD_STD


			def      UpperCamelCase		(    self      ,      lowercase      ,      lowercase      ,      lowercase = PILImageResampling.BILINEAR      ,      lowercase = None      ,      **lowercase      ,      )  ->						np.ndarray:
							'''simple docstring'''






							A__        =			get_size_dict(lowercase      ,      default_to_square=lowercase       )
							if "shortest_edge" in size:
											A__        =			get_resize_output_image_size(lowercase      ,      size["shortest_edge"]      ,      default_to_square=lowercase       )
							elif "height" in size and "width" in size:
											A__        =			(size["height"], size["width"])
							else:
											raise ValueError(F'Size must have \'height\' and \'width\' or \'shortest_edge\' as keys. Got {size.keys()}'       )
							return resize(lowercase      ,      size=lowercase      ,      resample=lowercase      ,      data_format=lowercase      ,      **lowercase       )


			def      UpperCamelCase		(    self      ,      lowercase      ,      lowercase      ,      lowercase = None      ,      **lowercase      ,      )  ->						np.ndarray:
							'''simple docstring'''






							A__        =			get_size_dict(lowercase       )
							if "height" not in size or "width" not in size:
											raise ValueError(F'Size must have \'height\' and \'width\' as keys. Got {size.keys()}'       )
							return center_crop(lowercase      ,      size=(size["height"], size["width"])      ,      data_format=lowercase      ,      **lowercase       )


			def      UpperCamelCase		(    self      ,      lowercase      ,      lowercase      ,      lowercase = True      ,      lowercase = None      ,      **lowercase      ,      )  ->						Any:
							'''simple docstring'''






							A__        =			image.astype(np.floataa       )
							if offset:
											A__        =			image - (scale / 2)
							return rescale(lowercase      ,      scale=lowercase      ,      data_format=lowercase      ,      **lowercase       )


			def      UpperCamelCase		(    self      ,      lowercase      ,      lowercase      ,      lowercase      ,      lowercase = None      ,      **lowercase      ,      )  ->						np.ndarray:
							'''simple docstring'''






							return normalize(lowercase      ,      mean=lowercase      ,      std=lowercase      ,      data_format=lowercase      ,      **lowercase       )


			def      UpperCamelCase		(    self      ,      lowercase      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = ChannelDimension.FIRST      ,      )  ->						np.ndarray:
							'''simple docstring'''






							if do_resize and size is None or resample is None:
											raise ValueError("Size and resample must be specified if do_resize is True."       )

							if do_center_crop and crop_size is None:
											raise ValueError("Crop size must be specified if do_center_crop is True."       )

							if do_rescale and rescale_factor is None:
											raise ValueError("Rescale factor must be specified if do_rescale is True."       )

							if do_normalize and (image_mean is None or image_std is None):
											raise ValueError("Image mean and std must be specified if do_normalize is True."       )

							if offset and not do_rescale:
											raise ValueError("For offset, do_rescale must also be set to True."       )

							# All transformations expect numpy arrays.
							A__        =			to_numpy_array(lowercase       )

							if do_resize:
											A__        =			self.resize(image=lowercase      ,      size=lowercase      ,      resample=lowercase       )

							if do_center_crop:
											A__        =			self.center_crop(lowercase      ,      size=lowercase       )

							if do_rescale:
											A__        =			self.rescale(image=lowercase      ,      scale=lowercase      ,      offset=lowercase       )

							if do_normalize:
											A__        =			self.normalize(image=lowercase      ,      mean=lowercase      ,      std=lowercase       )

							A__        =			to_channel_dimension_format(lowercase      ,      lowercase       )
							return image


			def      UpperCamelCase		(    self      ,      lowercase      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = None      ,      lowercase = ChannelDimension.FIRST      ,      **lowercase      ,      )  ->						PIL.Image.Image:
							'''simple docstring'''






							A__        =			do_resize if do_resize is not None else self.do_resize
							A__        =			resample if resample is not None else self.resample
							A__        =			do_center_crop if do_center_crop is not None else self.do_center_crop
							A__        =			do_rescale if do_rescale is not None else self.do_rescale
							A__        =			rescale_factor if rescale_factor is not None else self.rescale_factor
							A__        =			offset if offset is not None else self.offset
							A__        =			do_normalize if do_normalize is not None else self.do_normalize
							A__        =			image_mean if image_mean is not None else self.image_mean
							A__        =			image_std if image_std is not None else self.image_std

							A__        =			size if size is not None else self.size
							A__        =			get_size_dict(lowercase      ,      default_to_square=lowercase       )
							A__        =			crop_size if crop_size is not None else self.crop_size
							A__        =			get_size_dict(lowercase      ,      param_name="crop_size"       )

							if not valid_images(lowercase       ):
											raise ValueError(
											    "Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
											    "torch.Tensor, tf.Tensor or jax.ndarray."       )

							A__        =			make_batched(lowercase       )

							A__        =			[
							    [
							        self._preprocess_image(
							            image=lowercase      ,      do_resize=lowercase      ,      size=lowercase      ,      resample=lowercase      ,      do_center_crop=lowercase      ,      crop_size=lowercase      ,      do_rescale=lowercase      ,      rescale_factor=lowercase      ,      offset=lowercase      ,      do_normalize=lowercase      ,      image_mean=lowercase      ,      image_std=lowercase      ,      data_format=lowercase      ,      )
							        for img in video
							    ]
							    for video in videos
							]

							A__        =			{"pixel_values": videos}
							return BatchFeature(data=lowercase      ,      tensor_type=lowercase       )




from math import factorial



def 					lowerCAmelCase__							(	SCREAMING_SNAKE_CASE_:							int = 1_0_0      )			->      int:




				'''simple docstring'''





				return sum(map(SCREAMING_SNAKE_CASE_	,       str(factorial(SCREAMING_SNAKE_CASE_      )      )      )      )


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

