






'''simple docstring'''






import math
from typing import Dict, Iterable, List, Optional, Tuple, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    get_image_size,
    is_torch_available,
    is_torch_tensor,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_torch_available():
      import torch

if is_vision_available():
      import PIL


__A    	=   logging.get_logger(__name__)




def        _SCREAMING_SNAKE_CASE  (				A  :       np.ndarray  ,		A  :       Union[int, Iterable[int]]  ,		A  :       bool  ,		A  :       int  )    -> Tuple[int, int]:







   """simple docstring"""
   def constraint_to_multiple_of(A  :       Any  ,		A  :       Optional[Any]  ,		A  :       List[Any]=0  ,		A  :       Union[str, Any]=None  ):
      __snake_case				:      Optional[Any]     							= round(val / multiple  ) * multiple

      if max_val is not None and x > max_val:
         __snake_case				:      Optional[Any]     							= math.floor(val / multiple  ) * multiple

      if x < min_val:
         __snake_case				:      Optional[int]     							= math.ceil(val / multiple  ) * multiple

      return x

   __snake_case				:      Tuple     							= (output_size, output_size) if isinstance(A  ,		A  ) else output_size

   __snake_case							,__snake_case				:      Any     							= get_image_size(A  )
   __snake_case							,__snake_case				:      Tuple     							= output_size

   # determine new height and width
   __snake_case				:      Optional[Any]     							= output_height / input_height
   __snake_case				:      List[Any]     							= output_width / input_width

   if keep_aspect_ratio:
      # scale as little as possible
      if abs(1 - scale_width  ) < abs(1 - scale_height  ):
         # fit width
         __snake_case				:      Optional[int]     							= scale_width
      else:
         # fit height
         __snake_case				:      Tuple     							= scale_height

   __snake_case				:      Optional[int]     							= constraint_to_multiple_of(scale_height * input_height  ,		multiple=A  )
   __snake_case				:      int     							= constraint_to_multiple_of(scale_width * input_width  ,		multiple=A  )

   return (new_height, new_width)





class a_    (    UpperCamelCase_							):
   _snake_case        =							["""pixel_values"""]







   def __init__(self					,   __a = True					,   __a = None					,   __a = PILImageResampling.BILINEAR					,   __a = False					,   __a = 1					,   __a = True					,   __a = 1 / 2_5_5					,   __a = True					,   __a = None					,   __a = None					,   **__a					,   )			->      None:
      """simple docstring"""






      super().__init__(**__a)
      __snake_case				:      Tuple     							= size if size is not None else {'height': 3_8_4, 'width': 3_8_4}
      __snake_case				:      Optional[int]     							= get_size_dict(__a)
      __snake_case				:      int     							= do_resize
      __snake_case				:      Any     							= size
      __snake_case				:      Any     							= keep_aspect_ratio
      __snake_case				:      int     							= ensure_multiple_of
      __snake_case				:      Dict     							= resample
      __snake_case				:      Union[str, Any]     							= do_rescale
      __snake_case				:      List[str]     							= rescale_factor
      __snake_case				:      int     							= do_normalize
      __snake_case				:      str     							= image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
      __snake_case				:      Tuple     							= image_std if image_std is not None else IMAGENET_STANDARD_STD







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a = False					,   __a = 1					,   __a = PILImageResampling.BICUBIC					,   __a = None					,   **__a					,   )			->      np.ndarray:
      """simple docstring"""






      __snake_case				:      Any     							= get_size_dict(__a)
      if "height" not in size or "width" not in size:
         raise ValueError(F"""The size dictionary must contain the keys 'height' and 'width'. Got {size.keys()}""")
      __snake_case				:      Optional[int]     							= get_resize_output_image_size(
          __a					,   output_size=(size['height'], size['width'])					,   keep_aspect_ratio=__a					,   multiple=__a					,   )
      return resize(__a					,   size=__a					,   resample=__a					,   data_format=__a					,   **__a)







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a = None					,   **__a					,   )			->      Union[str, Any]:
      """simple docstring"""






      return rescale(__a					,   scale=__a					,   data_format=__a					,   **__a)







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a					,   __a = None					,   **__a					,   )			->      np.ndarray:
      """simple docstring"""






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







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   __a = None					,   __a = ChannelDimension.FIRST					,   **__a					,   )			->      PIL.Image.Image:
      """simple docstring"""






      __snake_case				:      Optional[Any]     							= do_resize if do_resize is not None else self.do_resize
      __snake_case				:      Optional[int]     							= size if size is not None else self.size
      __snake_case				:      Any     							= get_size_dict(__a)
      __snake_case				:      Tuple     							= keep_aspect_ratio if keep_aspect_ratio is not None else self.keep_aspect_ratio
      __snake_case				:      List[Any]     							= ensure_multiple_of if ensure_multiple_of is not None else self.ensure_multiple_of
      __snake_case				:      List[str]     							= resample if resample is not None else self.resample
      __snake_case				:      int     							= do_rescale if do_rescale is not None else self.do_rescale
      __snake_case				:      List[Any]     							= rescale_factor if rescale_factor is not None else self.rescale_factor
      __snake_case				:      Dict     							= do_normalize if do_normalize is not None else self.do_normalize
      __snake_case				:      Dict     							= image_mean if image_mean is not None else self.image_mean
      __snake_case				:      Union[str, Any]     							= image_std if image_std is not None else self.image_std

      __snake_case				:      Optional[Any]     							= make_list_of_images(__a)

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

      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_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.')

      # All transformations expect numpy arrays.
      __snake_case				:      Any     							= [to_numpy_array(__a) for image in images]

      if do_resize:
         __snake_case				:      int     							= [self.resize(image=__a					,   size=__a					,   resample=__a) for image in images]

      if do_rescale:
         __snake_case				:      Optional[int]     							= [self.rescale(image=__a					,   scale=__a) for image in images]

      if do_normalize:
         __snake_case				:      Optional[int]     							= [self.normalize(image=__a					,   mean=__a					,   std=__a) for image in images]

      __snake_case				:      List[str]     							= [to_channel_dimension_format(__a					,   __a) for image in images]

      __snake_case				:      Any     							= {'pixel_values': images}
      return BatchFeature(data=__a					,   tensor_type=__a)







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a = None)			->      str:
      """simple docstring"""






      __snake_case				:      List[str]     							= outputs.logits

      # Resize logits and compute semantic segmentation maps
      if target_sizes is not None:
         if len(__a) != len(__a):
            raise ValueError(
                'Make sure that you pass in as many target sizes as the batch dimension of the logits')

         if is_torch_tensor(__a):
            __snake_case				:      int     							= target_sizes.numpy()

         __snake_case				:      List[str]     							= []

         for idx in range(len(__a)):
            __snake_case				:      List[str]     							= torch.nn.functional.interpolate(
                logits[idx].unsqueeze(dim=0)					,   size=target_sizes[idx]					,   mode='bilinear'					,   align_corners=__a)
            __snake_case				:      Dict     							= resized_logits[0].argmax(dim=0)
            semantic_segmentation.append(__a)
      else:
         __snake_case				:      Dict     							= logits.argmax(dim=1)
         __snake_case				:      Tuple     							= [semantic_segmentation[i] for i in range(semantic_segmentation.shape[0])]

      return semantic_segmentation







'''simple docstring'''






def        _SCREAMING_SNAKE_CASE  (				A  :       int  )    -> int:







   """simple docstring"""
   __snake_case				:      str     							= 1
   for i in range(1  ,		num + 1  ):
      fact *= i
   return fact




def        _SCREAMING_SNAKE_CASE  (				A  :       int  )    -> int:







   """simple docstring"""
   __snake_case				:      Union[str, Any]     							= 0
   while number > 0:
      __snake_case				:      Dict     							= number % 10
      sum_of_digits += last_digit
      __snake_case				:      Union[str, Any]     							= number // 10  # Removing the last_digit from the given number
   return sum_of_digits




def        _SCREAMING_SNAKE_CASE  (				A  :       int = 1_00  )    -> int:







   """simple docstring"""
   __snake_case				:      List[Any]     							= factorial(A  )
   __snake_case				:      Dict     							= split_and_add(A  )
   return result


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