"""simple docstring"""







import os
import pathlib
import tempfile
import uuid

import numpy as np

from ..utils import is_soundfile_availble, is_torch_available, is_vision_available, logging


_a	:	List[Any]=					logging.get_logger(__name__)

if is_vision_available():
	import PIL.Image
	from PIL import Image
	from PIL.Image import Image as ImageType
else:
	_a	:	int=					object

if is_torch_available():
	import torch

if is_soundfile_availble():
	import soundfile as sf

class 						UpperCamelCase     :



				def __init__(self							: Any      ,    _A							: List[str])       ->      Optional[int]:
					__snake_case     :				List[Any] 						=					value



				def __str__(self							: List[Any])       ->      Dict:
					return self.to_string()



				def    _lowercase	(self							: List[str])       ->      Union[str, Any]:
					logger.error(
					    'This is a raw AgentType of unknown type. Display in notebooks and string conversion will be unreliable')
					return self._value






				def    _lowercase	(self							: List[str])       ->      str:
					logger.error(
					    'This is a raw AgentType of unknown type. Display in notebooks and string conversion will be unreliable')
					return str(self._value)







class 						UpperCamelCase     (       lowercase ,      lowercase		):



				def    _lowercase	(self							: Union[str, Any])       ->      Dict:
					return self._value






				def    _lowercase	(self							: Union[str, Any])       ->      Optional[Any]:
					return self._value







class 						UpperCamelCase     (       lowercase ,      lowercase		):



				def __init__(self							: Union[str, Any]      ,    _A							: str)       ->      Any:
					super().__init__(_A)

					if not is_vision_available():
						raise ImportError('PIL must be installed in order to handle images.')

					__snake_case     :				Any 						=					None
					__snake_case     :				Optional[int] 						=					None
					__snake_case     :				Optional[Any] 						=					None

					if isinstance(_A      ,    _A):
						__snake_case     :				Any 						=					value
					elif isinstance(_A      ,    (str, pathlib.Path)):
						__snake_case     :				Dict 						=					value
					elif isinstance(_A      ,    torch.Tensor):
						__snake_case     :				int 						=					value
					else:
						raise ValueError(f"Unsupported type for {self.__class__.__name__}: {type(_A)}")



				def    _lowercase	(self							: List[str]      ,    _A							: Union[str, Any]=None      ,    _A							: Optional[Any]=None)       ->      str:
					from IPython.display import Image, display

					display(Image(self.to_string()))



				def    _lowercase	(self							: List[Any])       ->      Dict:
					if self._raw is not None:
						return self._raw

					if self._path is not None:
						__snake_case     :				Optional[Any] 						=					Image.open(self._path)
						return self._raw






				def    _lowercase	(self							: Optional[int])       ->      str:
					if self._path is not None:
						return self._path

					if self._raw is not None:
						__snake_case     :				List[Any] 						=					tempfile.mkdtemp()
						__snake_case     :				Union[str, Any] 						=					os.path.join(_A      ,    str(uuid.uuida()) + '.png')
						self._raw.save(self._path)

						return self._path

					if self._tensor is not None:
						__snake_case     :				Dict 						=					self._tensor.cpu().detach().numpy()

						# There is likely simpler than load into image into save
						__snake_case     :				List[str] 						=					Image.fromarray((array * 2_55).astype(np.uinta))

						__snake_case     :				Any 						=					tempfile.mkdtemp()
						__snake_case     :				Union[str, Any] 						=					os.path.join(_A      ,    str(uuid.uuida()) + '.png')

						img.save(self._path)

						return self._path







class 						UpperCamelCase     (       lowercase		):



				def __init__(self							: List[Any]      ,    _A							: Any      ,    _A							: str=1_60_00)       ->      Optional[Any]:
					super().__init__(_A)

					if not is_soundfile_availble():
						raise ImportError('soundfile must be installed in order to handle audio.')

					__snake_case     :				Tuple 						=					None
					__snake_case     :				Optional[int] 						=					None

					__snake_case     :				Tuple 						=					samplerate

					if isinstance(_A      ,    (str, pathlib.Path)):
						__snake_case     :				List[Any] 						=					value
					elif isinstance(_A      ,    torch.Tensor):
						__snake_case     :				Optional[Any] 						=					value
					else:
						raise ValueError(f"Unsupported audio type: {type(_A)}")



				def    _lowercase	(self							: Tuple      ,    _A							: Optional[int]=None      ,    _A							: Optional[Any]=None)       ->      int:
					from IPython.display import Audio, display

					display(Audio(self.to_string()      ,    rate=self.samplerate))



				def    _lowercase	(self							: Optional[Any])       ->      Union[str, Any]:
					if self._tensor is not None:
						return self._tensor

					if self._path is not None:
						__snake_case						,							__snake_case     :				Tuple 						=					sf.read(self._path)
						__snake_case     :				Optional[int] 						=					torch.tensor(_A)
						return self._tensor






				def    _lowercase	(self							: Tuple)       ->      int:
					if self._path is not None:
						return self._path

					if self._tensor is not None:
						__snake_case     :				List[Any] 						=					tempfile.mkdtemp()
						__snake_case     :				Union[str, Any] 						=					os.path.join(_A      ,    str(uuid.uuida()) + '.wav')
						sf.write(self._path      ,    self._tensor      ,    samplerate=self.samplerate)
						return self._path







_a	:	str=					{"text": AgentText, "image": AgentImage, "audio": AgentAudio}
_a	:	List[str]=					{str: AgentText}

if is_vision_available():
	_a	:	Tuple=					AgentImage
def     __UpperCAmelCase							(       *UpperCAmelCase_       :							Optional[int]     ,				**UpperCAmelCase_       :							Dict    )				->     Union[str, Any]:

	'''simple docstring'''





	__snake_case     :				str 						=					[(arg.to_raw() if isinstance(UpperCAmelCase_     ,				UpperCAmelCase_    ) else arg) for arg in args]
	__snake_case     :				Optional[Any] 						=					{k: (v.to_raw() if isinstance(UpperCAmelCase_     ,				UpperCAmelCase_    ) else v) for k, v in kwargs.items()}
	return args, kwargs

def     __UpperCAmelCase							(       UpperCAmelCase_       :							List[str]     ,				UpperCAmelCase_       :							List[Any]=None    )				->     Optional[int]:

	'''simple docstring'''





	if isinstance(UpperCAmelCase_     ,				UpperCAmelCase_    ):
		__snake_case     :				Optional[Any] 						=					{}
		for i, (k, v) in enumerate(outputs.items()    ):
			if output_types is not None:
				# If the class has defined outputs, we can map directly according to the class definition
				if output_types[i] in AGENT_TYPE_MAPPING:
					__snake_case     :				List[Any] 						=					AGENT_TYPE_MAPPING[output_types[i]](UpperCAmelCase_    )
				else:
					__snake_case     :				int 						=					AgentType(UpperCAmelCase_    )

			else:
				# If the class does not have defined output, then we map according to the type
				for _k, _v in INSTANCE_TYPE_MAPPING.items():
					if isinstance(UpperCAmelCase_     ,				_k    ):
						__snake_case     :				Any 						=					_v(UpperCAmelCase_    )
				if k not in decoded_outputs:
					__snake_case     :				List[Any] 						=					AgentType[v]

	elif isinstance(UpperCAmelCase_     ,				(list, tuple)    ):
		__snake_case     :				str 						=					type(UpperCAmelCase_    )()
		for i, v in enumerate(UpperCAmelCase_    ):
			if output_types is not None:
				# If the class has defined outputs, we can map directly according to the class definition
				if output_types[i] in AGENT_TYPE_MAPPING:
					decoded_outputs.append(AGENT_TYPE_MAPPING[output_types[i]](UpperCAmelCase_    )    )
				else:
					decoded_outputs.append(AgentType(UpperCAmelCase_    )    )
			else:
				# If the class does not have defined output, then we map according to the type
				__snake_case     :				Tuple 						=					False
				for _k, _v in INSTANCE_TYPE_MAPPING.items():
					if isinstance(UpperCAmelCase_     ,				_k    ):
						decoded_outputs.append(_v(UpperCAmelCase_    )    )
						__snake_case     :				List[str] 						=					True

				if not found:
					decoded_outputs.append(AgentType(UpperCAmelCase_    )    )

	else:
		if output_types[0] in AGENT_TYPE_MAPPING:
			# If the class has defined outputs, we can map directly according to the class definition
			__snake_case     :				List[str] 						=					AGENT_TYPE_MAPPING[output_types[0]](UpperCAmelCase_    )

		else:
			# If the class does not have defined output, then we map according to the type
			for _k, _v in INSTANCE_TYPE_MAPPING.items():
				if isinstance(UpperCAmelCase_     ,				_k    ):
					return _v(UpperCAmelCase_    )
			return AgentType(UpperCAmelCase_    )

	return decoded_outputs






"""simple docstring"""







def     __UpperCAmelCase							(       UpperCAmelCase_       :							int = 1_00    )				->     int:

	'''simple docstring'''





	__snake_case     :				Any 						=					1
	__snake_case     :				Tuple 						=					0
	for i in range(1     ,				num + 1    ):
		fact *= i

	for j in str(UpperCAmelCase_    ):
		result += int(UpperCAmelCase_    )

	return result


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





