




"""simple docstring"""






import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple

import numpy as np

from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy


if is_flax_available():
			import jax.numpy as jnp






class lowerCAmelCase__      (	A__		):






			'''simple docstring'''



			def __get__(    self    , lowercase    , lowercase=None    ):
							# See docs.python.org/3/howto/descriptor.html#properties
							if obj is None:
											return self
							if self.fget is None:
											raise AttributeError('unreadable attribute'    )
							_lowerCamelCase	:     Union[str, Any]       =       '__cached_' + self.fget.__name__
							_lowerCamelCase	:     int       =       getattr(a__    , a__    , a__    )
							if cached is None:
											_lowerCamelCase	:     Any       =       self.fget(a__    )
											setattr(a__    , a__    , a__    )
							return cached







def 	_snake_case     (							lowercase__						):
				_lowerCamelCase	:     int       =       val.lower()
				if val in {"y", "yes", "t", "true", "on", "1"}:
								return 1
				if val in {"n", "no", "f", "false", "off", "0"}:
								return 0
				raise ValueError(f'''invalid truth value {val!r}'''						)







def 	_snake_case     (							lowercase__						):
				if is_torch_fx_proxy(UpperCamelCase_						):
								return True
				if is_torch_available():
								import torch

								if isinstance(UpperCamelCase_				,       torch.Tensor						):
												return True
				if is_tf_available():
								import tensorflow as tf

								if isinstance(UpperCamelCase_				,       tf.Tensor						):
												return True

				if is_flax_available():
								import jax.numpy as jnp
								from jax.core import Tracer

								if isinstance(UpperCamelCase_				,       (jnp.ndarray, Tracer)						):
												return True

				return isinstance(UpperCamelCase_				,       np.ndarray						)







def 	_snake_case     (							lowercase__						):
				return isinstance(UpperCamelCase_				,       np.ndarray						)







def 	_snake_case     (							lowercase__						):
				return _is_numpy(UpperCamelCase_						)







def 	_snake_case     (							lowercase__						):
				import torch

				return isinstance(UpperCamelCase_				,       torch.Tensor						)







def 	_snake_case     (							lowercase__						):
				return False if not is_torch_available() else _is_torch(UpperCamelCase_						)







def 	_snake_case     (							lowercase__						):
				import torch

				return isinstance(UpperCamelCase_				,       torch.device						)







def 	_snake_case     (							lowercase__						):
				return False if not is_torch_available() else _is_torch_device(UpperCamelCase_						)







def 	_snake_case     (							lowercase__						):
				import torch

				if isinstance(UpperCamelCase_				,       UpperCamelCase_						):
								if hasattr(UpperCamelCase_				,       UpperCamelCase_						):
												_lowerCamelCase	:     int       =       getattr(UpperCamelCase_				,       UpperCamelCase_						)
								else:
												return False
				return isinstance(UpperCamelCase_				,       torch.dtype						)







def 	_snake_case     (							lowercase__						):
				return False if not is_torch_available() else _is_torch_dtype(UpperCamelCase_						)







def 	_snake_case     (							lowercase__						):
				import tensorflow as tf

				return isinstance(UpperCamelCase_				,       tf.Tensor						)







def 	_snake_case     (							lowercase__						):
				return False if not is_tf_available() else _is_tensorflow(UpperCamelCase_						)







def 	_snake_case     (							lowercase__						):
				import tensorflow as tf

				# the `is_symbolic_tensor` predicate is only available starting with TF 2.14
				if hasattr(UpperCamelCase_				,       'is_symbolic_tensor'						):
								return tf.is_symbolic_tensor(UpperCamelCase_						)
				return type(UpperCamelCase_						) == tf.Tensor







def 	_snake_case     (							lowercase__						):
				return False if not is_tf_available() else _is_tf_symbolic_tensor(UpperCamelCase_						)







def 	_snake_case     (							lowercase__						):
				import jax.numpy as jnp  # noqa: F811

				return isinstance(UpperCamelCase_				,       jnp.ndarray						)







def 	_snake_case     (							lowercase__						):
				return False if not is_flax_available() else _is_jax(UpperCamelCase_						)







def 	_snake_case     (							lowercase__						):
				if isinstance(UpperCamelCase_				,       (dict, UserDict)						):
								return {k: to_py_obj(UpperCamelCase_						) for k, v in obj.items()}
				elif isinstance(UpperCamelCase_				,       (list, tuple)						):
								return [to_py_obj(UpperCamelCase_						) for o in obj]
				elif is_tf_tensor(UpperCamelCase_						):
								return obj.numpy().tolist()
				elif is_torch_tensor(UpperCamelCase_						):
								return obj.detach().cpu().tolist()
				elif is_jax_tensor(UpperCamelCase_						):
								return np.asarray(UpperCamelCase_						).tolist()
				elif isinstance(UpperCamelCase_				,       (np.ndarray, np.number)						):  # tolist also works on 0d np arrays
								return obj.tolist()
				else:
								return obj







def 	_snake_case     (							lowercase__						):
				if isinstance(UpperCamelCase_				,       (dict, UserDict)						):
								return {k: to_numpy(UpperCamelCase_						) for k, v in obj.items()}
				elif isinstance(UpperCamelCase_				,       (list, tuple)						):
								return np.array(UpperCamelCase_						)
				elif is_tf_tensor(UpperCamelCase_						):
								return obj.numpy()
				elif is_torch_tensor(UpperCamelCase_						):
								return obj.detach().cpu().numpy()
				elif is_jax_tensor(UpperCamelCase_						):
								return np.asarray(UpperCamelCase_						)
				else:
								return obj






class lowerCAmelCase__      (	A__		):






			'''simple docstring'''



			def    A_       (    self    ):
							_lowerCamelCase	:     List[str]       =       fields(self    )

							# Safety and consistency checks
							if not len(a__    ):
											raise ValueError(F'''{self.__class__.__name__} has no fields.'''    )
							if not all(field.default is None for field in class_fields[1:]    ):
											raise ValueError(F'''{self.__class__.__name__} should not have more than one required field.'''    )

							_lowerCamelCase	:     List[Any]       =       getattr(self    , class_fields[0].name    )
							_lowerCamelCase	:     Optional[int]       =       all(getattr(self    , field.name    ) is None for field in class_fields[1:]    )

							if other_fields_are_none and not is_tensor(a__    ):
											if isinstance(a__    , a__    ):
															_lowerCamelCase	:     int       =       first_field.items()
															_lowerCamelCase	:     Tuple       =       True
											else:
															try:
																			_lowerCamelCase	:     int       =       iter(a__    )
																			_lowerCamelCase	:     List[Any]       =       True
															except TypeError:
																			_lowerCamelCase	:     Optional[Any]       =       False

            # if we provided an iterator as first field and the iterator is a (key, value) iterator
            # set the associated fields
											if first_field_iterator:
															for idx, element in enumerate(a__    ):
																			if (
																			    not isinstance(a__    , (list, tuple)    )
																			    or not len(a__    ) == 2
																			    or not isinstance(element[0]    , a__    )
																			):
																							if idx == 0:
																											# If we do not have an iterator of key/values, set it as attribute
																											_lowerCamelCase	:     Optional[int]       =       first_field
																							else:
																											# If we have a mixed iterator, raise an error
																											raise ValueError(
																											    F'''Cannot set key/value for {element}. It needs to be a tuple (key, value).'''    )
																							break
																			setattr(self    , element[0]    , element[1]    )
																			if element[1] is not None:
																							_lowerCamelCase	:     List[Any]       =       element[1]
											elif first_field is not None:
															_lowerCamelCase	:     Dict       =       first_field
							else:
											for field in class_fields:
															_lowerCamelCase	:     List[str]       =       getattr(self    , field.name    )
															if v is not None:
																			_lowerCamelCase	:     List[str]       =       v
			def __delitem__(    self    , *lowercase    , **lowercase    ):
							raise Exception(F'''You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.'''    )
			def    A_       (    self    , *lowercase    , **lowercase    ):
							raise Exception(F'''You cannot use ``setdefault`` on a {self.__class__.__name__} instance.'''    )
			def    A_       (    self    , *lowercase    , **lowercase    ):
							raise Exception(F'''You cannot use ``pop`` on a {self.__class__.__name__} instance.'''    )
			def    A_       (    self    , *lowercase    , **lowercase    ):
							raise Exception(F'''You cannot use ``update`` on a {self.__class__.__name__} instance.'''    )
			def __getitem__(    self    , lowercase    ):
							if isinstance(a__    , a__    ):
											_lowerCamelCase	:     List[str]       =       dict(self.items()    )
											return inner_dict[k]
							else:
											return self.to_tuple()[k]
			def __setattr__(    self    , lowercase    , lowercase    ):
							if name in self.keys() and value is not None:
											# Don't call self.__setitem__ to avoid recursion errors
											super().__setitem__(a__    , a__    )
							super().__setattr__(a__    , a__    )
			def __setitem__(    self    , lowercase    , lowercase    ):
							# Will raise a KeyException if needed
							super().__setitem__(a__    , a__    )
							# Don't call self.__setattr__ to avoid recursion errors
							super().__setattr__(a__    , a__    )






			def    A_       (    self    ):
							return tuple(self[k] for k in self.keys()    )






class lowerCAmelCase__      (	A__,      A__		):






			'''simple docstring'''



			@classmethod
			def    A_       (    cls    , lowercase    ):
							raise ValueError(
							    F'''{value} is not a valid {cls.__name__}, please select one of {list(cls._valueamember_map_.keys()    )}'''    )






class lowerCAmelCase__      (	A__		):






			'''simple docstring'''



			lowerCamelCase__ =     """longest"""
			lowerCamelCase__ =     """max_length"""
			lowerCamelCase__ =     """do_not_pad"""






class lowerCAmelCase__      (	A__		):






			'''simple docstring'''



			lowerCamelCase__ =     """pt"""
			lowerCamelCase__ =     """tf"""
			lowerCamelCase__ =     """np"""
			lowerCamelCase__ =     """jax"""






class lowerCAmelCase__      :






			'''simple docstring'''



			def __init__(    self    , lowercase    ):
							_lowerCamelCase	:     str       =       context_managers
							_lowerCamelCase	:     Union[str, Any]       =       ExitStack()
			def __enter__(    self    ):
							for context_manager in self.context_managers:
											self.stack.enter_context(a__    )






			def __exit__(    self    , *lowercase    , **lowercase    ):
							self.stack.__exit__(*a__    , **a__    )







def 	_snake_case     (							lowercase__						):
				_lowerCamelCase	:     Dict       =       infer_framework(UpperCamelCase_						)
				if framework == "tf":
								_lowerCamelCase	:     str       =       inspect.signature(model_class.call						)  # TensorFlow models
				elif framework == "pt":
								_lowerCamelCase	:     Tuple       =       inspect.signature(model_class.forward						)  # PyTorch models
				else:
								_lowerCamelCase	:     List[str]       =       inspect.signature(model_class.__call__						)  # Flax models

				for p in signature.parameters:
								if p == "return_loss" and signature.parameters[p].default is True:
												return True

				return False







def 	_snake_case     (							lowercase__						):
				_lowerCamelCase	:     int       =       model_class.__name__
				_lowerCamelCase	:     Tuple       =       infer_framework(UpperCamelCase_						)
				if framework == "tf":
								_lowerCamelCase	:     List[Any]       =       inspect.signature(model_class.call						)  # TensorFlow models
				elif framework == "pt":
								_lowerCamelCase	:     Dict       =       inspect.signature(model_class.forward						)  # PyTorch models
				else:
								_lowerCamelCase	:     Optional[Any]       =       inspect.signature(model_class.__call__						)  # Flax models

				if "QuestionAnswering" in model_name:
								return [p for p in signature.parameters if "label" in p or p in ("start_positions", "end_positions")]
				else:
								return [p for p in signature.parameters if "label" in p]







def 	_snake_case     (							lowercase__				,       lowercase__ = ""				,       lowercase__ = "."						):

				def _flatten_dict(lowercase__				,       lowercase__=""				,       lowercase__="."						):
								for k, v in d.items():
												_lowerCamelCase	:     Optional[int]       =       str(UpperCamelCase_						) + delimiter + str(UpperCamelCase_						) if parent_key else k
												if v and isinstance(UpperCamelCase_				,       UpperCamelCase_						):
																yield from flatten_dict(UpperCamelCase_				,       UpperCamelCase_				,       delimiter=UpperCamelCase_						).items()
												else:
																yield key, v

				return dict(_flatten_dict(UpperCamelCase_				,       UpperCamelCase_				,       UpperCamelCase_						)						)







@contextmanager
def 	_snake_case     (							lowercase__				,       lowercase__ = False						):
				if use_temp_dir:
								with tempfile.TemporaryDirectory() as tmp_dir:
												yield tmp_dir
				else:
								yield working_dir







def 	_snake_case     (							lowercase__				,       lowercase__=None						):
				if is_numpy_array(UpperCamelCase_						):
								return np.transpose(UpperCamelCase_				,       axes=UpperCamelCase_						)
				elif is_torch_tensor(UpperCamelCase_						):
								return array.T if axes is None else array.permute(*UpperCamelCase_						)
				elif is_tf_tensor(UpperCamelCase_						):
								import tensorflow as tf

								return tf.transpose(UpperCamelCase_				,       perm=UpperCamelCase_						)
				elif is_jax_tensor(UpperCamelCase_						):
								return jnp.transpose(UpperCamelCase_				,       axes=UpperCamelCase_						)
				else:
								raise ValueError(f'''Type not supported for transpose: {type(UpperCamelCase_						)}.'''						)







def 	_snake_case     (							lowercase__				,       lowercase__						):
				if is_numpy_array(UpperCamelCase_						):
								return np.reshape(UpperCamelCase_				,       UpperCamelCase_						)
				elif is_torch_tensor(UpperCamelCase_						):
								return array.reshape(*UpperCamelCase_						)
				elif is_tf_tensor(UpperCamelCase_						):
								import tensorflow as tf

								return tf.reshape(UpperCamelCase_				,       UpperCamelCase_						)
				elif is_jax_tensor(UpperCamelCase_						):
								return jnp.reshape(UpperCamelCase_				,       UpperCamelCase_						)
				else:
								raise ValueError(f'''Type not supported for reshape: {type(UpperCamelCase_						)}.'''						)







def 	_snake_case     (							lowercase__				,       lowercase__=None						):
				if is_numpy_array(UpperCamelCase_						):
								return np.squeeze(UpperCamelCase_				,       axis=UpperCamelCase_						)
				elif is_torch_tensor(UpperCamelCase_						):
								return array.squeeze() if axis is None else array.squeeze(dim=UpperCamelCase_						)
				elif is_tf_tensor(UpperCamelCase_						):
								import tensorflow as tf

								return tf.squeeze(UpperCamelCase_				,       axis=UpperCamelCase_						)
				elif is_jax_tensor(UpperCamelCase_						):
								return jnp.squeeze(UpperCamelCase_				,       axis=UpperCamelCase_						)
				else:
								raise ValueError(f'''Type not supported for squeeze: {type(UpperCamelCase_						)}.'''						)







def 	_snake_case     (							lowercase__				,       lowercase__						):
				if is_numpy_array(UpperCamelCase_						):
								return np.expand_dims(UpperCamelCase_				,       UpperCamelCase_						)
				elif is_torch_tensor(UpperCamelCase_						):
								return array.unsqueeze(dim=UpperCamelCase_						)
				elif is_tf_tensor(UpperCamelCase_						):
								import tensorflow as tf

								return tf.expand_dims(UpperCamelCase_				,       axis=UpperCamelCase_						)
				elif is_jax_tensor(UpperCamelCase_						):
								return jnp.expand_dims(UpperCamelCase_				,       axis=UpperCamelCase_						)
				else:
								raise ValueError(f'''Type not supported for expand_dims: {type(UpperCamelCase_						)}.'''						)







def 	_snake_case     (							lowercase__						):
				if is_numpy_array(UpperCamelCase_						):
								return np.size(UpperCamelCase_						)
				elif is_torch_tensor(UpperCamelCase_						):
								return array.numel()
				elif is_tf_tensor(UpperCamelCase_						):
								import tensorflow as tf

								return tf.size(UpperCamelCase_						)
				elif is_jax_tensor(UpperCamelCase_						):
								return array.size
				else:
								raise ValueError(f'''Type not supported for expand_dims: {type(UpperCamelCase_						)}.'''						)







def 	_snake_case     (							lowercase__				,       lowercase__						):
				for key, value in auto_map.items():
								if isinstance(UpperCamelCase_				,       (tuple, list)						):
												_lowerCamelCase	:     List[Any]       =       [f'''{repo_id}--{v}''' if (v is not None and '--' not in v) else v for v in value]
								elif value is not None and "--" not in value:
												_lowerCamelCase	:     Tuple       =       f'''{repo_id}--{value}'''

				return auto_map







def 	_snake_case     (							lowercase__						):
				for base_class in inspect.getmro(UpperCamelCase_						):
								_lowerCamelCase	:     List[Any]       =       base_class.__module__
								_lowerCamelCase	:     List[str]       =       base_class.__name__
								if module.startswith('tensorflow'						) or module.startswith('keras'						) or name == "TFPreTrainedModel":
												return "tf"
								elif module.startswith('torch'						) or name == "PreTrainedModel":
												return "pt"
								elif module.startswith('flax'						) or module.startswith('jax'						) or name == "FlaxPreTrainedModel":
												return "flax"
				else:
								raise TypeError(f'''Could not infer framework from class {model_class}.'''						)




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