
from collections import OrderedDict
from typing import Any, Mapping, Optional

from ... import PreTrainedTokenizer
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import TensorType, is_torch_available, logging


__snake_case					:							List[str]           =							logging.get_logger(__name__)

__snake_case					:							Optional[Any]           =							{
    'facebook/mbart-large-cc25': 'https://huggingface.co/facebook/mbart-large-cc25/resolve/main/config.json',
    # See all MBART models at https://huggingface.co/models?filter=mbart
}


class 	UpperCamelCase__       (  _lowerCamelCase):

						'''simple docstring'''



						__a     :    Dict												=			"""mbart"""
						__a     :    List[str]												=			["""past_key_values"""]
						__a     :    List[str]												=			{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}


						def __init__(  self  , A=5_02_65  , A=10_24  , A=12  , A=40_96  , A=16  , A=12  , A=40_96  , A=16  , A=0.0  , A=0.0  , A=True  , A=True  , A="gelu"  , A=10_24  , A=0.1  , A=0.0  , A=0.0  , A=0.02  , A=0.0  , A=False  , A=1  , A=0  , A=2  , A=2  , **A  , )  ->Optional[int]:
									UpperCAmelCase__		:Any 		=    vocab_size
									UpperCAmelCase__		:List[Any] 		=    max_position_embeddings
									UpperCAmelCase__		:Any 		=    d_model
									UpperCAmelCase__		:List[Any] 		=    encoder_ffn_dim
									UpperCAmelCase__		:Union[str, Any] 		=    encoder_layers
									UpperCAmelCase__		:Optional[Any] 		=    encoder_attention_heads
									UpperCAmelCase__		:Any 		=    decoder_ffn_dim
									UpperCAmelCase__		:Union[str, Any] 		=    decoder_layers
									UpperCAmelCase__		:Any 		=    decoder_attention_heads
									UpperCAmelCase__		:Any 		=    dropout
									UpperCAmelCase__		:List[Any] 		=    attention_dropout
									UpperCAmelCase__		:str 		=    activation_dropout
									UpperCAmelCase__		:Optional[int] 		=    activation_function
									UpperCAmelCase__		:Union[str, Any] 		=    init_std
									UpperCAmelCase__		:Union[str, Any] 		=    encoder_layerdrop
									UpperCAmelCase__		:Dict 		=    decoder_layerdrop
									UpperCAmelCase__		:Dict 		=    classifier_dropout
									UpperCAmelCase__		:List[str] 		=    use_cache
									UpperCAmelCase__		:Any 		=    encoder_layers
									UpperCAmelCase__		:Any 		=    scale_embedding  # scale factor will be sqrt(d_model) if True
									super().__init__(
									    pad_token_id=lowerCAmelCase_  , bos_token_id=lowerCAmelCase_  , eos_token_id=lowerCAmelCase_  , is_encoder_decoder=lowerCAmelCase_  , forced_eos_token_id=lowerCAmelCase_  , **lowerCAmelCase_  , )


class 	UpperCamelCase__       (  _lowerCamelCase):

						'''simple docstring'''



						@property
						def    A__       (  self	)  ->Mapping[str, Mapping[int, str]]:
									if self.task in ["default", "seq2seq-lm"]:
												UpperCAmelCase__		:str 		=    OrderedDict(
												    [
												        ('input_ids', {0: 'batch', 1: 'encoder_sequence'}),
												        ('attention_mask', {0: 'batch', 1: 'encoder_sequence'}),
												    ]	)

												if self.use_past:
															UpperCAmelCase__		:Tuple 		=    {0: 'batch'}
															UpperCAmelCase__		:Tuple 		=    {0: 'batch', 1: 'past_decoder_sequence + sequence'}
												else:
															UpperCAmelCase__		:List[Any] 		=    {0: 'batch', 1: 'decoder_sequence'}
															UpperCAmelCase__		:Dict 		=    {0: 'batch', 1: 'decoder_sequence'}

												if self.use_past:
															self.fill_with_past_key_values_(lowerCAmelCase_  , direction='inputs'	)
									elif self.task == "causal-lm":
												# TODO: figure this case out.
												UpperCAmelCase__		:Any 		=    OrderedDict(
												    [
												        ('input_ids', {0: 'batch', 1: 'encoder_sequence'}),
												        ('attention_mask', {0: 'batch', 1: 'encoder_sequence'}),
												    ]	)
												if self.use_past:
															UpperCAmelCase__		,       UpperCAmelCase__		:List[Any] 		=    self.num_layers
															for i in range(lowerCAmelCase_	):
																		UpperCAmelCase__		:Union[str, Any] 		=    {0: 'batch', 2: 'past_sequence + sequence'}
																		UpperCAmelCase__		:Tuple 		=    {0: 'batch', 2: 'past_sequence + sequence'}
									else:
												UpperCAmelCase__		:Tuple 		=    OrderedDict(
												    [
												        ('input_ids', {0: 'batch', 1: 'encoder_sequence'}),
												        ('attention_mask', {0: 'batch', 1: 'encoder_sequence'}),
												        ('decoder_input_ids', {0: 'batch', 1: 'decoder_sequence'}),
												        ('decoder_attention_mask', {0: 'batch', 1: 'decoder_sequence'}),
												    ]	)

									return common_inputs


						@property
						def    A__       (  self	)  ->Mapping[str, Mapping[int, str]]:
									if self.task in ["default", "seq2seq-lm"]:
												UpperCAmelCase__		:List[str] 		=    super().outputs
									else:
												UpperCAmelCase__		:int 		=    super(lowerCAmelCase_  , self	).outputs
												if self.use_past:
															UpperCAmelCase__		,       UpperCAmelCase__		:int 		=    self.num_layers
															for i in range(lowerCAmelCase_	):
																		UpperCAmelCase__		:Tuple 		=    {0: 'batch', 2: 'past_sequence + sequence'}
																		UpperCAmelCase__		:Any 		=    {0: 'batch', 2: 'past_sequence + sequence'}
									return common_outputs


						def    A__       (  self  , A  , A = -1  , A = -1  , A = False  , A = None  , )  ->Mapping[str, Any]:
									UpperCAmelCase__		:Dict 		=    self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
									    lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_	)

									# Generate decoder inputs
									UpperCAmelCase__		:Any 		=    seq_length if not self.use_past else 1
									UpperCAmelCase__		:str 		=    self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
									    lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_	)
									UpperCAmelCase__		:Optional[int] 		=    {F"""decoder_{name}""": tensor for name, tensor in decoder_inputs.items()}
									UpperCAmelCase__		:List[Any] 		=    dict(**lowerCAmelCase_  , **lowerCAmelCase_	)

									if self.use_past:
												if not is_torch_available():
															raise ValueError('Cannot generate dummy past_keys inputs without PyTorch installed.'	)
												else:
															import torch
												UpperCAmelCase__		,       UpperCAmelCase__		:Union[str, Any] 		=    common_inputs['input_ids'].shape
												UpperCAmelCase__		:List[str] 		=    common_inputs['decoder_input_ids'].shape[1]
												UpperCAmelCase__		,       UpperCAmelCase__		:Optional[Any] 		=    self.num_attention_heads
												UpperCAmelCase__		:Union[str, Any] 		=    (
												    batch,
												    num_encoder_attention_heads,
												    encoder_seq_length,
												    self._config.hidden_size // num_encoder_attention_heads,
												)
												UpperCAmelCase__		:Tuple 		=    decoder_seq_length + 3
												UpperCAmelCase__		:int 		=    (
												    batch,
												    num_decoder_attention_heads,
												    decoder_past_length,
												    self._config.hidden_size // num_decoder_attention_heads,
												)

												UpperCAmelCase__		:Union[str, Any] 		=    torch.cat(
												    [common_inputs['decoder_attention_mask'], torch.ones(lowerCAmelCase_  , lowerCAmelCase_	)]  , dim=1	)

												UpperCAmelCase__		:List[str] 		=    []
												# If the number of encoder and decoder layers are present in the model configuration, both are considered
												UpperCAmelCase__		,       UpperCAmelCase__		:Any 		=    self.num_layers
												UpperCAmelCase__		:List[str] 		=    min(lowerCAmelCase_  , lowerCAmelCase_	)
												UpperCAmelCase__		:Union[str, Any] 		=    max(lowerCAmelCase_  , lowerCAmelCase_	) - min_num_layers
												UpperCAmelCase__		:List[str] 		=    'encoder' if num_encoder_layers > num_decoder_layers else 'decoder'

												for _ in range(lowerCAmelCase_	):
															common_inputs["past_key_values"].append(
															    (
															        torch.zeros(lowerCAmelCase_	),
															        torch.zeros(lowerCAmelCase_	),
															        torch.zeros(lowerCAmelCase_	),
															        torch.zeros(lowerCAmelCase_	),
															    )	)
												# TODO: test this.
												UpperCAmelCase__		:str 		=    encoder_shape if remaining_side_name == 'encoder' else decoder_shape
												for _ in range(lowerCAmelCase_  , lowerCAmelCase_	):
															common_inputs["past_key_values"].append((torch.zeros(lowerCAmelCase_	), torch.zeros(lowerCAmelCase_	))	)
									return common_inputs


						def    A__       (  self  , A  , A = -1  , A = -1  , A = False  , A = None  , )  ->Mapping[str, Any]:
									UpperCAmelCase__		:List[str] 		=    self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
									    lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_	)

									if self.use_past:
												if not is_torch_available():
															raise ValueError('Cannot generate dummy past_keys inputs without PyTorch installed.'	)
												else:
															import torch
												UpperCAmelCase__		,       UpperCAmelCase__		:str 		=    common_inputs['input_ids'].shape
												# Not using the same length for past_key_values
												UpperCAmelCase__		:Tuple 		=    seqlen + 2
												UpperCAmelCase__		,       UpperCAmelCase__		:Tuple 		=    self.num_layers
												UpperCAmelCase__		,       UpperCAmelCase__		:Optional[Any] 		=    self.num_attention_heads
												UpperCAmelCase__		:List[str] 		=    (
												    batch,
												    num_encoder_attention_heads,
												    past_key_values_length,
												    self._config.hidden_size // num_encoder_attention_heads,
												)

												UpperCAmelCase__		:str 		=    common_inputs['attention_mask'].dtype
												UpperCAmelCase__		:Any 		=    torch.cat(
												    [common_inputs['attention_mask'], torch.ones(lowerCAmelCase_  , lowerCAmelCase_  , dtype=lowerCAmelCase_	)]  , dim=1	)
												UpperCAmelCase__		:List[str] 		=    [
												    (torch.zeros(lowerCAmelCase_	), torch.zeros(lowerCAmelCase_	)) for _ in range(lowerCAmelCase_	)
												]
									return common_inputs


						def    A__       (  self  , A  , A = -1  , A = -1  , A = False  , A = None  , )  ->Mapping[str, Any]:
									# Copied from OnnxConfig.generate_dummy_inputs
									# Did not use super(OnnxConfigWithPast, self).generate_dummy_inputs for code clarity.
									# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
									UpperCAmelCase__		:Optional[Any] 		=    compute_effective_axis_dimension(
									    lowerCAmelCase_  , fixed_dimension=OnnxConfig.default_fixed_batch  , num_token_to_add=0	)

									# If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
									UpperCAmelCase__		:List[Any] 		=    tokenizer.num_special_tokens_to_add(lowerCAmelCase_	)
									UpperCAmelCase__		:Union[str, Any] 		=    compute_effective_axis_dimension(
									    lowerCAmelCase_  , fixed_dimension=OnnxConfig.default_fixed_sequence  , num_token_to_add=lowerCAmelCase_	)

									# Generate dummy inputs according to compute batch and sequence
									UpperCAmelCase__		:Optional[int] 		=    [' '.join([tokenizer.unk_token]	) * seq_length] * batch_size
									UpperCAmelCase__		:Dict 		=    dict(tokenizer(lowerCAmelCase_  , return_tensors=lowerCAmelCase_	)	)
									return common_inputs


						def    A__       (  self  , A  , A = -1  , A = -1  , A = False  , A = None  , )  ->Mapping[str, Any]:
									if self.task in ["default", "seq2seq-lm"]:
												UpperCAmelCase__		:Tuple 		=    self._generate_dummy_inputs_for_default_and_seqaseq_lm(
												    lowerCAmelCase_  , batch_size=lowerCAmelCase_  , seq_length=lowerCAmelCase_  , is_pair=lowerCAmelCase_  , framework=lowerCAmelCase_	)

									elif self.task == "causal-lm":
												UpperCAmelCase__		:Dict 		=    self._generate_dummy_inputs_for_causal_lm(
												    lowerCAmelCase_  , batch_size=lowerCAmelCase_  , seq_length=lowerCAmelCase_  , is_pair=lowerCAmelCase_  , framework=lowerCAmelCase_	)
									else:
												UpperCAmelCase__		:str 		=    self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
												    lowerCAmelCase_  , batch_size=lowerCAmelCase_  , seq_length=lowerCAmelCase_  , is_pair=lowerCAmelCase_  , framework=lowerCAmelCase_	)

									return common_inputs


						def    A__       (  self  , A  , A  , A  , A	)  ->Dict:
									if self.task in ["default", "seq2seq-lm"]:
												UpperCAmelCase__		:List[str] 		=    super()._flatten_past_key_values_(lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_	)
									else:
												UpperCAmelCase__		:List[str] 		=    super(lowerCAmelCase_  , self	)._flatten_past_key_values_(
												    lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_  , lowerCAmelCase_	)












def     lowerCamelCase__  (  UpperCamelCase__      :							int = 100    )      ->			int:



					'''simple docstring'''




					_snake_case						=					1
					_snake_case						=					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())))



