






"""simple docstring"""





import gc
import unittest

from transformers import CTRLConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch

							from transformers import (
							    CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
							    CTRLForSequenceClassification,
							    CTRLLMHeadModel,
							    CTRLModel,
							)



class       __A		:

					def __init__(			self  :      Optional[int]     ,		__snake_case  :      int     ,		__snake_case  :      str=1_4     ,		__snake_case  :      Any=7     ,		__snake_case  :      Dict=True     ,		__snake_case  :      Union[str, Any]=True     ,		__snake_case  :      List[str]=True     ,		__snake_case  :      Any=True     ,		__snake_case  :      Dict=True     ,		__snake_case  :      int=9_9     ,		__snake_case  :      Tuple=3_2     ,		__snake_case  :      List[str]=5     ,		__snake_case  :      Optional[Any]=4     ,		__snake_case  :      Optional[int]=3_7     ,		__snake_case  :      Optional[int]="gelu"     ,		__snake_case  :      Tuple=0.1     ,		__snake_case  :      Optional[int]=0.1     ,		__snake_case  :      Optional[int]=5_1_2     ,		__snake_case  :      List[Any]=1_6     ,		__snake_case  :      Tuple=2     ,		__snake_case  :      str=0.02     ,		__snake_case  :      str=3     ,		__snake_case  :      int=4     ,		__snake_case  :      Dict=None     ,		)			->							List[str]:
											__magic_name__:	Tuple							=       parent
											__magic_name__:	int							=       batch_size
											__magic_name__:	str							=       seq_length
											__magic_name__:	Optional[int]							=       is_training
											__magic_name__:	Dict							=       use_token_type_ids
											__magic_name__:	str							=       use_input_mask
											__magic_name__:	int							=       use_labels
											__magic_name__:	Union[str, Any]							=       use_mc_token_ids
											__magic_name__:	str							=       vocab_size
											__magic_name__:	List[str]							=       hidden_size
											__magic_name__:	Any							=       num_hidden_layers
											__magic_name__:	int							=       num_attention_heads
											__magic_name__:	Dict							=       intermediate_size
											__magic_name__:	Optional[Any]							=       hidden_act
											__magic_name__:	Any							=       hidden_dropout_prob
											__magic_name__:	Dict							=       attention_probs_dropout_prob
											__magic_name__:	List[Any]							=       max_position_embeddings
											__magic_name__:	List[str]							=       type_vocab_size
											__magic_name__:	int							=       type_sequence_label_size
											__magic_name__:	Optional[int]							=       initializer_range
											__magic_name__:	Optional[int]							=       num_labels
											__magic_name__:	str							=       num_choices
											__magic_name__:	Optional[Any]							=       scope
											__magic_name__:	Union[str, Any]							=       self.vocab_size - 1

					def   lowerCamelCase__   (			self  :      Optional[int]					)			->							List[Any]:
											__magic_name__:	Union[str, Any]							=       ids_tensor([self.batch_size, self.seq_length]     ,		self.vocab_size					)

											__magic_name__:	Dict							=       None
											if self.use_input_mask:
																	__magic_name__:	Any							=       random_attention_mask([self.batch_size, self.seq_length]					)

											__magic_name__:	List[Any]							=       None
											if self.use_token_type_ids:
																	__magic_name__:	List[str]							=       ids_tensor([self.batch_size, self.seq_length]     ,		self.type_vocab_size					)

											__magic_name__:	Dict							=       None
											if self.use_mc_token_ids:
																	__magic_name__:	Any							=       ids_tensor([self.batch_size, self.num_choices]     ,		self.seq_length					)

											__magic_name__:	List[Any]							=       None
											__magic_name__:	Any							=       None
											__magic_name__:	List[Any]							=       None
											if self.use_labels:
																	__magic_name__:	List[str]							=       ids_tensor([self.batch_size]     ,		self.type_sequence_label_size					)
																	__magic_name__:	Union[str, Any]							=       ids_tensor([self.batch_size, self.seq_length]     ,		self.num_labels					)
																	__magic_name__:	Dict							=       ids_tensor([self.batch_size]     ,		self.num_choices					)

											__magic_name__:	Tuple							=       self.get_config()

											__magic_name__:	Optional[int]							=       ids_tensor([self.num_hidden_layers, self.num_attention_heads]     ,		2					)

											return (
											    config,
											    input_ids,
											    input_mask,
											    head_mask,
											    token_type_ids,
											    mc_token_ids,
											    sequence_labels,
											    token_labels,
											    choice_labels,
											)

					def   lowerCamelCase__   (			self  :      Any					)			->							Optional[Any]:
											return CTRLConfig(
											    vocab_size=self.vocab_size     ,		n_embd=self.hidden_size     ,		n_layer=self.num_hidden_layers     ,		n_head=self.num_attention_heads     ,		n_positions=self.max_position_embeddings     ,		pad_token_id=self.pad_token_id     ,		)

					def   lowerCamelCase__   (			self  :      Any     ,		__snake_case  :      int     ,		__snake_case  :      int     ,		__snake_case  :      int     ,		__snake_case  :      List[Any]     ,		__snake_case  :      Optional[int]     ,		*__snake_case  :      Dict					)			->							Any:
											__magic_name__:	Any							=       CTRLModel(config=__snake_case					)
											model.to(__snake_case					)
											model.eval()

											model(__snake_case     ,		token_type_ids=__snake_case     ,		head_mask=__snake_case					)
											model(__snake_case     ,		token_type_ids=__snake_case					)
											__magic_name__:	List[Any]							=       model(__snake_case					)
											self.parent.assertEqual(result.last_hidden_state.shape     ,		(self.batch_size, self.seq_length, self.hidden_size)					)
											self.parent.assertEqual(len(result.past_key_values					)     ,		config.n_layer					)

					def   lowerCamelCase__   (			self  :      Union[str, Any]     ,		__snake_case  :      str     ,		__snake_case  :      int     ,		__snake_case  :      Any     ,		__snake_case  :      Optional[Any]     ,		__snake_case  :      Dict     ,		*__snake_case  :      Any					)			->							Union[str, Any]:
											__magic_name__:	List[Any]							=       CTRLLMHeadModel(__snake_case					)
											model.to(__snake_case					)
											model.eval()

											__magic_name__:	Optional[Any]							=       model(__snake_case     ,		token_type_ids=__snake_case     ,		labels=__snake_case					)
											self.parent.assertEqual(result.loss.shape     ,		()					)
											self.parent.assertEqual(result.logits.shape     ,		(self.batch_size, self.seq_length, self.vocab_size)					)

					def   lowerCamelCase__   (			self  :      Dict					)			->							Optional[int]:
											__magic_name__:	List[str]							=       self.prepare_config_and_inputs()

											(
											    (
											    __magic_name__
											),			(
											    __magic_name__
											),			(
											    __magic_name__
											),			(
											    __magic_name__
											),			(
											    __magic_name__
											),			(
											    __magic_name__
											),			(
											    __magic_name__
											),			(
											    __magic_name__
											),			(
											    __magic_name__
											),			
											):	int							=       config_and_inputs

											__magic_name__:	int							=       {"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """head_mask""": head_mask}

											return config, inputs_dict






					def   lowerCamelCase__   (			self  :      List[str]     ,		__snake_case  :      List[Any]     ,		__snake_case  :      str     ,		__snake_case  :      str     ,		__snake_case  :      Optional[int]     ,		*__snake_case  :      Union[str, Any]					)			->							str:
											__magic_name__:	int							=       self.num_labels
											__magic_name__:	int							=       CTRLForSequenceClassification(__snake_case					)
											model.to(__snake_case					)
											model.eval()
											__magic_name__:	str							=       ids_tensor([self.batch_size]     ,		self.type_sequence_label_size					)
											__magic_name__:	int							=       model(__snake_case     ,		token_type_ids=__snake_case     ,		labels=__snake_case					)
											self.parent.assertEqual(result.logits.shape     ,		(self.batch_size, self.num_labels)					)



@require_torch
class       __A		(   SCREAMING_SNAKE_CASE_     ,SCREAMING_SNAKE_CASE_     ,SCREAMING_SNAKE_CASE_     ,unittest.TestCase			):
					UpperCAmelCase__								=				(CTRLModel, CTRLLMHeadModel, CTRLForSequenceClassification) if is_torch_available() else ()
					UpperCAmelCase__								=				(CTRLLMHeadModel,) if is_torch_available() else ()
					UpperCAmelCase__								=				(
					    {
					        "feature-extraction": CTRLModel,
					        "text-classification": CTRLForSequenceClassification,
					        "text-generation": CTRLLMHeadModel,
					        "zero-shot": CTRLForSequenceClassification,
					    }
					    if is_torch_available()
					    else {}
					)
					UpperCAmelCase__								=				True
					UpperCAmelCase__								=				False
					UpperCAmelCase__								=				False

					def   lowerCamelCase__   (			self  :      Optional[Any]     ,		__snake_case  :      Optional[int]     ,		__snake_case  :      Tuple     ,		__snake_case  :      List[str]     ,		__snake_case  :      int     ,		__snake_case  :      Optional[int]					)			->							Dict:
											if pipeline_test_casse_name == "ZeroShotClassificationPipelineTests":
																	# Get `tokenizer does not have a padding token` error for both fast/slow tokenizers.
																	# `CTRLConfig` was never used in pipeline tests, either because of a missing checkpoint or because a tiny
																	# config could not be created.
																	return True

											return False

					def   lowerCamelCase__   (			self  :      Union[str, Any]					)			->							Union[str, Any]:
											__magic_name__:	str							=       CTRLModelTester(self					)
											__magic_name__:	Optional[int]							=       ConfigTester(self     ,		config_class=__snake_case     ,		n_embd=3_7					)

					def   lowerCamelCase__   (			self  :      List[str]					)			->							Optional[int]:
											super().tearDown()
											# clean-up as much as possible GPU memory occupied by PyTorch
											gc.collect()
											torch.cuda.empty_cache()

					def   lowerCamelCase__   (			self  :      Tuple					)			->							List[str]:
											self.config_tester.run_common_tests()

					def   lowerCamelCase__   (			self  :      List[str]					)			->							List[Any]:
											__magic_name__:	Optional[Any]							=       self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_ctrl_model(*__snake_case					)

					def   lowerCamelCase__   (			self  :      Any					)			->							Tuple:
											__magic_name__:	Optional[Any]							=       self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_lm_head_model(*__snake_case					)

					@unittest.skip("""Will be fixed soon by reducing the size of the model used for common tests."""					)
					def   lowerCamelCase__   (			self  :      Tuple					)			->							Dict:
											pass

					@slow
					def   lowerCamelCase__   (			self  :      Dict					)			->							Optional[Any]:
											for model_name in CTRL_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																	__magic_name__:	Union[str, Any]							=       CTRLModel.from_pretrained(__snake_case					)
																	self.assertIsNotNone(__snake_case					)






					@unittest.skip("""The model doesn't support left padding"""					)  # and it's not used enough to be worth fixing :)
					def   lowerCamelCase__   (			self  :      Optional[int]					)			->							List[Any]:
											pass



@require_torch
class       __A		(   unittest.TestCase			):

					def   lowerCamelCase__   (			self  :      Tuple					)			->							str:
											super().tearDown()
											# clean-up as much as possible GPU memory occupied by PyTorch
											gc.collect()
											torch.cuda.empty_cache()






					@slow
					def   lowerCamelCase__   (			self  :      Optional[int]					)			->							List[Any]:
											__magic_name__:	Optional[Any]							=       CTRLLMHeadModel.from_pretrained("""ctrl"""					)
											model.to(__snake_case					)
											__magic_name__:	List[str]							=       torch.tensor(
											    [[1_1_8_5_9, 0, 1_6_1_1, 8]]     ,		dtype=torch.long     ,		device=__snake_case					)  # Legal the president is
											__magic_name__:	List[Any]							=       [
											    1_1_8_5_9,
											    0,
											    1_6_1_1,
											    8,
											    5,
											    1_5_0,
											    2_6_4_4_9,
											    2,
											    1_9,
											    3_4_8,
											    4_6_9,
											    3,
											    2_5_9_5,
											    4_8,
											    2_0_7_4_0,
											    2_4_6_5_3_3,
											    2_4_6_5_3_3,
											    1_9,
											    3_0,
											    5,
											]  # Legal the president is a good guy and I don't want to lose my job. \n \n I have a

											__magic_name__:	Optional[int]							=       model.generate(__snake_case     ,		do_sample=__snake_case					)
											self.assertListEqual(output_ids[0].tolist()     ,		__snake_case					)







"""simple docstring"""






def 				A_       ( snake_case__		)					->  int:
			_UpperCamelCase					:Dict					     =	1
			for i in range(1       ,					num + 1		):
						fact *= i
			return fact





def 				A_       ( snake_case__		)					->  int:
			_UpperCamelCase					:Dict					     =	0
			while number > 0:
						_UpperCamelCase					:Tuple					     =	number % 10
						sum_of_digits += last_digit
						_UpperCamelCase					:str					     =	number // 10  # Removing the last_digit from the given number
			return sum_of_digits





def 				A_       ( snake_case__ = 1_00		)					->  int:
			_UpperCamelCase					:int					     =	factorial(snake_case__		)
			_UpperCamelCase					:Dict					     =	split_and_add(snake_case__		)
			return result


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

