




"""simple docstring"""






import gc
import tempfile
import unittest

import numpy as np
import torch

from diffusers import VersatileDiffusionPipeline
from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device


lowercase__			=		False






class lowerCAmelCase__      (	unittest.TestCase		):






			'''simple docstring'''



			pass






@nightly
@require_torch_gpu
class lowerCAmelCase__      (	unittest.TestCase		):






			'''simple docstring'''



			def    A_       (    self    ):
							# clean up the VRAM after each test
							super().tearDown()
							gc.collect()
							torch.cuda.empty_cache()
			def    A_       (    self    ):
							_lowerCamelCase	:     Any       =       VersatileDiffusionPipeline.from_pretrained('shi-labs/versatile-diffusion'    , torch_dtype=torch.floataa    )
							pipe.to(a__    )
							pipe.set_progress_bar_config(disable=a__    )

							_lowerCamelCase	:     str       =       load_image(
							    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg'    )

							_lowerCamelCase	:     Optional[Any]       =       torch.manual_seed(0    )
							_lowerCamelCase	:     Dict       =       pipe.dual_guided(
							    prompt='first prompt'    , image=a__    , text_to_image_strength=0.75    , generator=a__    , guidance_scale=7.5    , num_inference_steps=2    , output_type='numpy'    , ).images

							with tempfile.TemporaryDirectory() as tmpdirname:
											pipe.save_pretrained(a__    )
											_lowerCamelCase	:     List[Any]       =       VersatileDiffusionPipeline.from_pretrained(a__    , torch_dtype=torch.floataa    )
							pipe.to(a__    )
							pipe.set_progress_bar_config(disable=a__    )

							_lowerCamelCase	:     Optional[int]       =       generator.manual_seed(0    )
							_lowerCamelCase	:     int       =       pipe.dual_guided(
							    prompt='first prompt'    , image=a__    , text_to_image_strength=0.75    , generator=a__    , guidance_scale=7.5    , num_inference_steps=2    , output_type='numpy'    , ).images

							assert np.abs(image - new_image    ).sum() < 1E-5, "Models don't have the same forward pass"






			def    A_       (    self    ):
							_lowerCamelCase	:     str       =       VersatileDiffusionPipeline.from_pretrained('shi-labs/versatile-diffusion'    , torch_dtype=torch.floataa    )
							pipe.to(a__    )
							pipe.set_progress_bar_config(disable=a__    )

							_lowerCamelCase	:     Tuple       =       'cyberpunk 2077'
							_lowerCamelCase	:     Optional[Any]       =       load_image(
							    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg'    )
							_lowerCamelCase	:     int       =       torch.manual_seed(0    )
							_lowerCamelCase	:     Dict       =       pipe.dual_guided(
							    prompt=a__    , image=a__    , text_to_image_strength=0.75    , generator=a__    , guidance_scale=7.5    , num_inference_steps=50    , output_type='numpy'    , ).images

							_lowerCamelCase	:     str       =       image[0, 253:256, 253:256, -1]

							assert image.shape == (1, 512, 512, 3)
							_lowerCamelCase	:     str       =       np.array([0.14_48, 0.16_19, 0.17_41, 0.10_86, 0.11_47, 0.11_28, 0.11_99, 0.11_65, 0.10_01]    )

							assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-1

							_lowerCamelCase	:     Any       =       'A painting of a squirrel eating a burger '
							_lowerCamelCase	:     Union[str, Any]       =       torch.manual_seed(0    )
							_lowerCamelCase	:     Optional[Any]       =       pipe.text_to_image(
							    prompt=a__    , generator=a__    , guidance_scale=7.5    , num_inference_steps=50    , output_type='numpy'    ).images

							_lowerCamelCase	:     str       =       image[0, 253:256, 253:256, -1]

							assert image.shape == (1, 512, 512, 3)
							_lowerCamelCase	:     Tuple       =       np.array([0.33_67, 0.31_69, 0.26_56, 0.38_70, 0.47_90, 0.37_96, 0.40_09, 0.48_78, 0.47_78]    )

							assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-1

							_lowerCamelCase	:     Tuple       =       pipe.image_variation(a__    , generator=a__    , output_type='numpy'    ).images

							_lowerCamelCase	:     str       =       image[0, 253:256, 253:256, -1]

							assert image.shape == (1, 512, 512, 3)
							_lowerCamelCase	:     Tuple       =       np.array([0.30_76, 0.31_23, 0.32_84, 0.37_82, 0.37_70, 0.38_94, 0.42_97, 0.43_31, 0.44_56]    )

							assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-1




def 		lowerCAmelCase__     (       UpperCamelCase_					:							int						)->	int:
    A__					=       1
    for i in range(1			,							num + 1						):
        fact *= i
    return fact



def 		lowerCAmelCase__     (       UpperCamelCase_					:							int						)->	int:
    A__					=       0
    while number > 0:
        A__					=       number % 1_0
        sum_of_digits += last_digit
        A__					=       number // 1_0  # Removing the last_digit from the given number
    return sum_of_digits



def 		lowerCAmelCase__     (       UpperCamelCase_					:							int = 1_0_0						)->	int:
    A__					=       factorial(UpperCamelCase_						)
    A__					=       split_and_add(UpperCamelCase_						)
    return result


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