






import unittest

import numpy as np

from transformers.testing_utils import is_flaky, 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 DonutImageProcessor





class       __a  (   unittest.TestCase	):







 def __init__(		self :       List[Any]							,       SCREAMING_SNAKE_CASE :       Dict							,       SCREAMING_SNAKE_CASE :       List[str]=7							,       SCREAMING_SNAKE_CASE :       List[str]=3							,       SCREAMING_SNAKE_CASE :       Optional[int]=18							,       SCREAMING_SNAKE_CASE :       Dict=30							,       SCREAMING_SNAKE_CASE :       List[str]=4_00							,       SCREAMING_SNAKE_CASE :       Union[str, Any]=True							,       SCREAMING_SNAKE_CASE :       Any=None							,       SCREAMING_SNAKE_CASE :       str=True							,       SCREAMING_SNAKE_CASE :       int=False							,       SCREAMING_SNAKE_CASE :       Dict=True							,       SCREAMING_SNAKE_CASE :       List[str]=True							,       SCREAMING_SNAKE_CASE :       List[str]=[0.5, 0.5, 0.5]							,       SCREAMING_SNAKE_CASE :       Optional[int]=[0.5, 0.5, 0.5]							,       ):


      '''simple docstring'''






      UpperCamelCase__      :       Optional[int]	    =  parent
      UpperCamelCase__      :       List[Any]	    =  batch_size
      UpperCamelCase__      :       List[str]	    =  num_channels
      UpperCamelCase__      :       Tuple	    =  image_size
      UpperCamelCase__      :       Union[str, Any]	    =  min_resolution
      UpperCamelCase__      :       Optional[int]	    =  max_resolution
      UpperCamelCase__      :       List[Any]	    =  do_resize
      UpperCamelCase__      :       Tuple	    =  size if size is not None else {"height": 18, "width": 20}
      UpperCamelCase__      :       int	    =  do_thumbnail
      UpperCamelCase__      :       Any	    =  do_align_axis
      UpperCamelCase__      :       List[str]	    =  do_pad
      UpperCamelCase__      :       List[Any]	    =  do_normalize
      UpperCamelCase__      :       str	    =  image_mean
      UpperCamelCase__      :       str	    =  image_std







 def  __lowercase (		self :       List[Any]						):


      '''simple docstring'''






      return {
          "do_resize": self.do_resize,
          "size": self.size,
          "do_thumbnail": self.do_thumbnail,
          "do_align_long_axis": self.do_align_axis,
          "do_pad": self.do_pad,
          "do_normalize": self.do_normalize,
          "image_mean": self.image_mean,
          "image_std": self.image_std,
      }







@require_torch
@require_vision
class       __a  (   A__	,       unittest.TestCase	):
 _lowerCAmelCase	:	Tuple				=			DonutImageProcessor if is_vision_available() else None







 def  __lowercase (		self :       Union[str, Any]						):


      '''simple docstring'''






      UpperCamelCase__      :       Optional[Any]	    =  DonutImageProcessingTester(self						)







 @property
 def  __lowercase (		self :       Optional[int]						):


      '''simple docstring'''






      return self.image_processor_tester.prepare_image_processor_dict()







 def  __lowercase (		self :       List[str]						):


      '''simple docstring'''






      UpperCamelCase__      :       int	    =  self.image_processing_class(**self.image_processor_dict						)
      self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,       "do_resize"						)						)
      self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,       "size"						)						)
      self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,       "do_thumbnail"						)						)
      self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,       "do_align_long_axis"						)						)
      self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,       "do_pad"						)						)
      self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,       "do_normalize"						)						)
      self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,       "image_mean"						)						)
      self.assertTrue(hasattr(SCREAMING_SNAKE_CASE							,       "image_std"						)						)







 def  __lowercase (		self :       Dict						):


      '''simple docstring'''






      UpperCamelCase__      :       List[str]	    =  self.image_processing_class.from_dict(self.image_processor_dict						)
      self.assertEqual(image_processor.size							,       {"height": 18, "width": 20}						)

      UpperCamelCase__      :       Tuple	    =  self.image_processing_class.from_dict(self.image_processor_dict							,       size=42						)
      self.assertEqual(image_processor.size							,       {"height": 42, "width": 42}						)

      # Previous config had dimensions in (width, height) order
      UpperCamelCase__      :       Any	    =  self.image_processing_class.from_dict(self.image_processor_dict							,       size=(42, 84)						)
      self.assertEqual(image_processor.size							,       {"height": 84, "width": 42}						)







 def  __lowercase (		self :       Dict						):


      '''simple docstring'''






      pass







 @is_flaky()
 def  __lowercase (		self :       Optional[Any]						):


      '''simple docstring'''






      UpperCamelCase__      :       Union[str, Any]	    =  self.image_processing_class(**self.image_processor_dict						)
      # create random PIL images
      UpperCamelCase__      :       Optional[Any]	    =  prepare_image_inputs(self.image_processor_tester							,       equal_resolution=SCREAMING_SNAKE_CASE						)
      for image in image_inputs:
           self.assertIsInstance(SCREAMING_SNAKE_CASE							,       Image.Image						)

      # Test not batched input
      UpperCamelCase__      :       Optional[int]	    =  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.size["height"],
              self.image_processor_tester.size["width"],
          )							,       )

      # Test batched
      UpperCamelCase__      :       Tuple	    =  image_processing(SCREAMING_SNAKE_CASE							,       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.size["height"],
              self.image_processor_tester.size["width"],
          )							,       )







 @is_flaky()
 def  __lowercase (		self :       List[Any]						):


      '''simple docstring'''






      UpperCamelCase__      :       Dict	    =  self.image_processing_class(**self.image_processor_dict						)
      # create random numpy tensors
      UpperCamelCase__      :       Union[str, Any]	    =  prepare_image_inputs(self.image_processor_tester							,       equal_resolution=SCREAMING_SNAKE_CASE							,       numpify=SCREAMING_SNAKE_CASE						)
      for image in image_inputs:
           self.assertIsInstance(SCREAMING_SNAKE_CASE							,       np.ndarray						)

      # Test not batched input
      UpperCamelCase__      :       Optional[int]	    =  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.size["height"],
              self.image_processor_tester.size["width"],
          )							,       )

      # Test batched
      UpperCamelCase__      :       int	    =  image_processing(SCREAMING_SNAKE_CASE							,       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.size["height"],
              self.image_processor_tester.size["width"],
          )							,       )







 @is_flaky()
 def  __lowercase (		self :       Any						):


      '''simple docstring'''






      UpperCamelCase__      :       Optional[Any]	    =  self.image_processing_class(**self.image_processor_dict						)
      # create random PyTorch tensors
      UpperCamelCase__      :       str	    =  prepare_image_inputs(self.image_processor_tester							,       equal_resolution=SCREAMING_SNAKE_CASE							,       torchify=SCREAMING_SNAKE_CASE						)
      for image in image_inputs:
           self.assertIsInstance(SCREAMING_SNAKE_CASE							,       torch.Tensor						)

      # Test not batched input
      UpperCamelCase__      :       Optional[int]	    =  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.size["height"],
              self.image_processor_tester.size["width"],
          )							,       )

      # Test batched
      UpperCamelCase__      :       str	    =  image_processing(SCREAMING_SNAKE_CASE							,       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.size["height"],
              self.image_processor_tester.size["width"],
          )							,       )







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase      )			->     int:
     UpperCamelCase__      :       int	    =  1
     for i in range(1 ,   num + 1      ):
          fact *= i
     return fact







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase      )			->     int:
     UpperCamelCase__      :       List[Any]	    =  0
     while number > 0:
          UpperCamelCase__      :       List[Any]	    =  number % 10
          sum_of_digits += last_digit
          UpperCamelCase__      :       int	    =  number // 10  # Removing the last_digit from the given number
     return sum_of_digits







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase = 100      )			->     int:
     UpperCamelCase__      :       Optional[Any]	    =  factorial(__lowerCAmelCase      )
     UpperCamelCase__      :       Optional[int]	    =  split_and_add(__lowerCAmelCase      )
     return result


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