


import unittest

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

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 (
	    MPNetForMaskedLM,
	    MPNetForMultipleChoice,
	    MPNetForQuestionAnswering,
	    MPNetForSequenceClassification,
	    MPNetForTokenClassification,
	    MPNetModel,
	)


class 			lowerCamelCase_		:





				"""simple docstring"""







				def __init__(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__=13       ,		UpperCAmelCase__=7       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__=False       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__=99       ,		UpperCAmelCase__=64       ,		UpperCAmelCase__=5       ,		UpperCAmelCase__=4       ,		UpperCAmelCase__=64       ,		UpperCAmelCase__="gelu"       ,		UpperCAmelCase__=0.1       ,		UpperCAmelCase__=0.1       ,		UpperCAmelCase__=512       ,		UpperCAmelCase__=16       ,		UpperCAmelCase__=2       ,		UpperCAmelCase__=0.02       ,		UpperCAmelCase__=3       ,		UpperCAmelCase__=4       ,		UpperCAmelCase__=None       ,		):
								SCREAMING_SNAKE_CASE__     							=				parent
								SCREAMING_SNAKE_CASE__     							=				batch_size
								SCREAMING_SNAKE_CASE__     							=				seq_length
								SCREAMING_SNAKE_CASE__     							=				is_training
								SCREAMING_SNAKE_CASE__     							=				use_input_mask
								SCREAMING_SNAKE_CASE__     							=				use_token_type_ids
								SCREAMING_SNAKE_CASE__     							=				use_labels
								SCREAMING_SNAKE_CASE__     							=				vocab_size
								SCREAMING_SNAKE_CASE__     							=				hidden_size
								SCREAMING_SNAKE_CASE__     							=				num_hidden_layers
								SCREAMING_SNAKE_CASE__     							=				num_attention_heads
								SCREAMING_SNAKE_CASE__     							=				intermediate_size
								SCREAMING_SNAKE_CASE__     							=				hidden_act
								SCREAMING_SNAKE_CASE__     							=				hidden_dropout_prob
								SCREAMING_SNAKE_CASE__     							=				attention_probs_dropout_prob
								SCREAMING_SNAKE_CASE__     							=				max_position_embeddings
								SCREAMING_SNAKE_CASE__     							=				type_vocab_size
								SCREAMING_SNAKE_CASE__     							=				type_sequence_label_size
								SCREAMING_SNAKE_CASE__     							=				initializer_range
								SCREAMING_SNAKE_CASE__     							=				num_labels
								SCREAMING_SNAKE_CASE__     							=				num_choices
								SCREAMING_SNAKE_CASE__     							=				scope



				def   lowerCAmelCase__		(						self     ):
								return MPNetConfig.from_pretrained("microsoft/mpnet-base"     )



				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				ids_tensor([self.batch_size, self.seq_length]       ,		self.vocab_size     )

								SCREAMING_SNAKE_CASE__     							=				None
								if self.use_input_mask:
												SCREAMING_SNAKE_CASE__     							=				random_attention_mask([self.batch_size, self.seq_length]     )

								SCREAMING_SNAKE_CASE__     							=				None
								SCREAMING_SNAKE_CASE__     							=				None
								SCREAMING_SNAKE_CASE__     							=				None
								if self.use_labels:
												SCREAMING_SNAKE_CASE__     							=				ids_tensor([self.batch_size]       ,		self.type_sequence_label_size     )
												SCREAMING_SNAKE_CASE__     							=				ids_tensor([self.batch_size, self.seq_length]       ,		self.num_labels     )
												SCREAMING_SNAKE_CASE__     							=				ids_tensor([self.batch_size]       ,		self.num_choices     )

								SCREAMING_SNAKE_CASE__     							=				self.get_config()
								return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels



				def   lowerCAmelCase__		(						self     ):
								return MPNetConfig(
								    vocab_size=self.vocab_size       ,		hidden_size=self.hidden_size       ,		num_hidden_layers=self.num_hidden_layers       ,		num_attention_heads=self.num_attention_heads       ,		intermediate_size=self.intermediate_size       ,		hidden_act=self.hidden_act       ,		hidden_dropout_prob=self.hidden_dropout_prob       ,		attention_probs_dropout_prob=self.attention_probs_dropout_prob       ,		max_position_embeddings=self.max_position_embeddings       ,		initializer_range=self.initializer_range       ,		)



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__     ):
								SCREAMING_SNAKE_CASE__     							=				MPNetModel(config=UpperCAmelCase__     )
								model.to(UpperCAmelCase__     )
								model.eval()
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__       ,		UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.last_hidden_state.shape       ,		(self.batch_size, self.seq_length, self.hidden_size)     )
								self.parent.assertEqual(result.pooler_output.shape       ,		(self.batch_size, self.hidden_size)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__     ):
								SCREAMING_SNAKE_CASE__     							=				MPNetForQuestionAnswering(config=UpperCAmelCase__     )
								model.to(UpperCAmelCase__     )
								model.eval()
								SCREAMING_SNAKE_CASE__     							=				model(
								    UpperCAmelCase__       ,		attention_mask=UpperCAmelCase__       ,		start_positions=UpperCAmelCase__       ,		end_positions=UpperCAmelCase__       ,		)
								self.parent.assertEqual(result.start_logits.shape       ,		(self.batch_size, self.seq_length)     )
								self.parent.assertEqual(result.end_logits.shape       ,		(self.batch_size, self.seq_length)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__     ):
								SCREAMING_SNAKE_CASE__     							=				self.num_labels
								SCREAMING_SNAKE_CASE__     							=				MPNetForSequenceClassification(UpperCAmelCase__     )
								model.to(UpperCAmelCase__     )
								model.eval()
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__       ,		attention_mask=UpperCAmelCase__       ,		labels=UpperCAmelCase__     )
								self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.num_labels)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__     ):
								SCREAMING_SNAKE_CASE__     							=				self.num_choices
								SCREAMING_SNAKE_CASE__     							=				MPNetForMultipleChoice(config=UpperCAmelCase__     )
								model.to(UpperCAmelCase__     )
								model.eval()
								SCREAMING_SNAKE_CASE__     							=				input_ids.unsqueeze(1     ).expand(-1       ,		self.num_choices       ,		-1     ).contiguous()
								SCREAMING_SNAKE_CASE__     							=				input_mask.unsqueeze(1     ).expand(-1       ,		self.num_choices       ,		-1     ).contiguous()
								SCREAMING_SNAKE_CASE__     							=				model(
								    UpperCAmelCase__       ,		attention_mask=UpperCAmelCase__       ,		labels=UpperCAmelCase__       ,		)
								self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.num_choices)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__     ):
								SCREAMING_SNAKE_CASE__     							=				self.num_labels
								SCREAMING_SNAKE_CASE__     							=				MPNetForTokenClassification(config=UpperCAmelCase__     )
								model.to(UpperCAmelCase__     )
								model.eval()
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__       ,		attention_mask=UpperCAmelCase__       ,		labels=UpperCAmelCase__     )
								self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.seq_length, self.num_labels)     )






				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				self.prepare_config_and_inputs()
								((SCREAMING_SNAKE_CASE__)							,      (SCREAMING_SNAKE_CASE__)							,      (SCREAMING_SNAKE_CASE__)							,      (SCREAMING_SNAKE_CASE__)							,      (SCREAMING_SNAKE_CASE__)							,      (SCREAMING_SNAKE_CASE__))     							=				config_and_inputs
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "attention_mask": input_mask}
								return config, inputs_dict


@require_torch
class 			lowerCamelCase_		(			lowercase       ,  lowercase       ,  unittest.TestCase   ):





				"""simple docstring"""







				_lowerCAmelCase      :      List[str]      							=					(
				    (
				        MPNetForMaskedLM,
				        MPNetForMultipleChoice,
				        MPNetForQuestionAnswering,
				        MPNetForSequenceClassification,
				        MPNetForTokenClassification,
				        MPNetModel,
				    )
				    if is_torch_available()
				    else ()
				)
				_lowerCAmelCase      :      Tuple      							=					(
				    {
				        "feature-extraction": MPNetModel,
				        "fill-mask": MPNetForMaskedLM,
				        "question-answering": MPNetForQuestionAnswering,
				        "text-classification": MPNetForSequenceClassification,
				        "token-classification": MPNetForTokenClassification,
				        "zero-shot": MPNetForSequenceClassification,
				    }
				    if is_torch_available()
				    else {}
				)
				_lowerCAmelCase      :      Tuple      							=					False
				_lowerCAmelCase      :      List[str]      							=					True



				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				MPNetModelTester(self     )
								SCREAMING_SNAKE_CASE__     							=				ConfigTester(self       ,		config_class=UpperCAmelCase__       ,		hidden_size=37     )



				def   lowerCAmelCase__		(						self     ):
								self.config_tester.run_common_tests()



				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_mpnet_model(*UpperCAmelCase__     )



				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_mpnet_for_sequence_classification(*UpperCAmelCase__     )



				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_mpnet_for_multiple_choice(*UpperCAmelCase__     )



				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_mpnet_for_token_classification(*UpperCAmelCase__     )






				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_mpnet_for_question_answering(*UpperCAmelCase__     )


@require_torch
class 			lowerCamelCase_		(			unittest.TestCase   ):





				"""simple docstring"""







				@slow
				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				MPNetModel.from_pretrained("microsoft/mpnet-base"     )
								SCREAMING_SNAKE_CASE__     							=				torch.tensor([[0, 345, 232, 328, 740, 140, 1695, 69, 6078, 1588, 2]]     )
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )[0]
								SCREAMING_SNAKE_CASE__     							=				torch.Size((1, 11, 768)     )
								self.assertEqual(output.shape       ,		UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				torch.tensor(
								    [[[-0.0_550, 0.1_943, -0.0_740], [-0.0_562, 0.2_211, -0.0_579], [-0.0_437, 0.3_337, -0.0_641]]]     )
								# compare the actual values for a slice.
								self.assertTrue(torch.allclose(output[:, :3, :3]       ,		UpperCAmelCase__       ,		atol=1e-4     )     )




"""simple docstring"""






from math import factorial


def __lowercase     (      lowerCamelCase_  :      int = 100  ):
				return sum(int(lowerCamelCase_  ) for x in str(factorial(lowerCamelCase_  )  )  )


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