






'''simple docstring'''






import unittest

import torch
from torch import nn

from accelerate.test_utils import require_cuda
from accelerate.utils.memory import find_executable_batch_size, release_memory




def        _SCREAMING_SNAKE_CASE  (				)    -> Any:







   """simple docstring"""
   raise RuntimeError('CUDA out of memory.'  )




class a_    (    nn.Module							):







   def __init__(self)			->      int:
      """simple docstring"""






      super().__init__()
      __snake_case				:      Any     							= nn.Linear(3					,   4)
      __snake_case				:      List[str]     							= nn.BatchNormad(4)
      __snake_case				:      Any     							= nn.Linear(4					,   5)







   def     SCREAMING_SNAKE_CASE__					(self					,   __a)			->      List[Any]:
      """simple docstring"""






      return self.lineara(self.batchnorm(self.lineara(__a)))




class a_    (    unittest.TestCase							):







   def     SCREAMING_SNAKE_CASE__					(self)			->      str:
      """simple docstring"""






      __snake_case				:      List[str]     							= []

      @find_executable_batch_size(starting_batch_size=1_2_8)
      def mock_training_loop_function(__a):
         nonlocal batch_sizes
         batch_sizes.append(__a)
         if batch_size != 8:
            raise_fake_out_of_memory()

      mock_training_loop_function()
      self.assertListEqual(__a					,   [1_2_8, 6_4, 3_2, 1_6, 8])







   def     SCREAMING_SNAKE_CASE__					(self)			->      Any:
      """simple docstring"""






      __snake_case				:      Tuple     							= []

      @find_executable_batch_size(starting_batch_size=1_2_8)
      def mock_training_loop_function(__a					,   __a):
         nonlocal batch_sizes
         batch_sizes.append(__a)
         if batch_size != 8:
            raise_fake_out_of_memory()
         return batch_size, arga

      __snake_case							,__snake_case				:      List[str]     							= mock_training_loop_function('hello')
      self.assertListEqual(__a					,   [1_2_8, 6_4, 3_2, 1_6, 8])
      self.assertListEqual([bs, arga]					,   [8, 'hello'])







   def     SCREAMING_SNAKE_CASE__					(self)			->      Dict:
      """simple docstring"""






      @find_executable_batch_size(starting_batch_size=0)
      def mock_training_loop_function(__a):
         pass

      with self.assertRaises(__a) as cm:
         mock_training_loop_function()
         self.assertIn('No executable batch size found, reached zero.'					,   cm.exception.args[0])







   def     SCREAMING_SNAKE_CASE__					(self)			->      Any:
      """simple docstring"""






      @find_executable_batch_size(starting_batch_size=1_6)
      def mock_training_loop_function(__a):
         if batch_size > 0:
            raise_fake_out_of_memory()
         pass

      with self.assertRaises(__a) as cm:
         mock_training_loop_function()
         self.assertIn('No executable batch size found, reached zero.'					,   cm.exception.args[0])







   def     SCREAMING_SNAKE_CASE__					(self)			->      List[str]:
      """simple docstring"""






      @find_executable_batch_size(starting_batch_size=1_2_8)
      def mock_training_loop_function(__a					,   __a					,   __a):
         if batch_size != 8:
            raise raise_fake_out_of_memory()

      with self.assertRaises(__a) as cm:
         mock_training_loop_function(1_2_8					,   'hello'					,   'world')
         self.assertIn('Batch size was passed into `f`'					,   cm.exception.args[0])
         self.assertIn('`f(arg1=\'hello\', arg2=\'world\')'					,   cm.exception.args[0])







   def     SCREAMING_SNAKE_CASE__					(self)			->      Optional[int]:
      """simple docstring"""






      @find_executable_batch_size(starting_batch_size=1_6)
      def mock_training_loop_function(__a):
         raise ValueError('Oops, we had an error!')

      with self.assertRaises(__a) as cm:
         mock_training_loop_function()
         self.assertIn('Oops, we had an error!'					,   cm.exception.args[0])







   @require_cuda
   def     SCREAMING_SNAKE_CASE__					(self)			->      int:
      """simple docstring"""






      __snake_case				:      Any     							= torch.cuda.memory_allocated()
      __snake_case				:      List[str]     							= ModelForTest()
      model.cuda()
      self.assertGreater(torch.cuda.memory_allocated()					,   __a)
      __snake_case				:      List[str]     							= release_memory(__a)
      self.assertEqual(torch.cuda.memory_allocated()					,   __a)







'''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())))