


"""simple docstring"""






from __future__ import annotations

import unittest

from transformers import FunnelConfig, is_tf_available
from transformers.testing_utils import require_tf

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
	import tensorflow as tf

	from transformers import (
	    TFFunnelBaseModel,
	    TFFunnelForMaskedLM,
	    TFFunnelForMultipleChoice,
	    TFFunnelForPreTraining,
	    TFFunnelForQuestionAnswering,
	    TFFunnelForSequenceClassification,
	    TFFunnelForTokenClassification,
	    TFFunnelModel,
	)


class 			lowerCamelCase_		:





				"""simple docstring"""







				def __init__(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__=13       ,		UpperCAmelCase__=7       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__=True       ,		UpperCAmelCase__=99       ,		UpperCAmelCase__=[1, 1, 2]       ,		UpperCAmelCase__=1       ,		UpperCAmelCase__=32       ,		UpperCAmelCase__=4       ,		UpperCAmelCase__=8       ,		UpperCAmelCase__=37       ,		UpperCAmelCase__="gelu_new"       ,		UpperCAmelCase__=0.1       ,		UpperCAmelCase__=0.1       ,		UpperCAmelCase__=0.0       ,		UpperCAmelCase__=512       ,		UpperCAmelCase__=3       ,		UpperCAmelCase__=0.02       ,		UpperCAmelCase__=3       ,		UpperCAmelCase__=4       ,		UpperCAmelCase__=None       ,		UpperCAmelCase__=False       ,		):
								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__     							=				block_sizes
								SCREAMING_SNAKE_CASE__     							=				num_decoder_layers
								SCREAMING_SNAKE_CASE__     							=				d_model
								SCREAMING_SNAKE_CASE__     							=				n_head
								SCREAMING_SNAKE_CASE__     							=				d_head
								SCREAMING_SNAKE_CASE__     							=				d_inner
								SCREAMING_SNAKE_CASE__     							=				hidden_act
								SCREAMING_SNAKE_CASE__     							=				hidden_dropout
								SCREAMING_SNAKE_CASE__     							=				attention_dropout
								SCREAMING_SNAKE_CASE__     							=				activation_dropout
								SCREAMING_SNAKE_CASE__     							=				max_position_embeddings
								SCREAMING_SNAKE_CASE__     							=				type_vocab_size
								SCREAMING_SNAKE_CASE__     							=				2
								SCREAMING_SNAKE_CASE__     							=				num_labels
								SCREAMING_SNAKE_CASE__     							=				num_choices
								SCREAMING_SNAKE_CASE__     							=				scope
								SCREAMING_SNAKE_CASE__     							=				initializer_std

								# Used in the tests to check the size of the first attention layer
								SCREAMING_SNAKE_CASE__     							=				n_head
								# Used in the tests to check the size of the first hidden state
								SCREAMING_SNAKE_CASE__     							=				self.d_model
								# Used in the tests to check the number of output hidden states/attentions
								SCREAMING_SNAKE_CASE__     							=				sum(self.block_sizes     ) + (0 if base else self.num_decoder_layers)
								# FunnelModel adds two hidden layers: input embeddings and the sum of the upsampled encoder hidden state with
								# the last hidden state of the first block (which is the first hidden state of the decoder).
								if not base:
												SCREAMING_SNAKE_CASE__     							=				self.num_hidden_layers + 2



				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
								if self.use_token_type_ids:
												SCREAMING_SNAKE_CASE__     							=				ids_tensor([self.batch_size, self.seq_length]       ,		self.type_vocab_size     )

								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__     							=				FunnelConfig(
								    vocab_size=self.vocab_size       ,		block_sizes=self.block_sizes       ,		num_decoder_layers=self.num_decoder_layers       ,		d_model=self.d_model       ,		n_head=self.n_head       ,		d_head=self.d_head       ,		d_inner=self.d_inner       ,		hidden_act=self.hidden_act       ,		hidden_dropout=self.hidden_dropout       ,		attention_dropout=self.attention_dropout       ,		activation_dropout=self.activation_dropout       ,		max_position_embeddings=self.max_position_embeddings       ,		type_vocab_size=self.type_vocab_size       ,		initializer_std=self.initializer_std       ,		)

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



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				TFFunnelModel(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )

								SCREAMING_SNAKE_CASE__     							=				[input_ids, input_mask]
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )

								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.last_hidden_state.shape       ,		(self.batch_size, self.seq_length, self.d_model)     )

								SCREAMING_SNAKE_CASE__     							=				False
								SCREAMING_SNAKE_CASE__     							=				TFFunnelModel(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.last_hidden_state.shape       ,		(self.batch_size, self.seq_length, self.d_model)     )

								SCREAMING_SNAKE_CASE__     							=				False
								SCREAMING_SNAKE_CASE__     							=				TFFunnelModel(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.last_hidden_state.shape       ,		(self.batch_size, self.seq_length, self.d_model)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				TFFunnelBaseModel(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )

								SCREAMING_SNAKE_CASE__     							=				[input_ids, input_mask]
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )

								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.last_hidden_state.shape       ,		(self.batch_size, 2, self.d_model)     )

								SCREAMING_SNAKE_CASE__     							=				False
								SCREAMING_SNAKE_CASE__     							=				TFFunnelBaseModel(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.last_hidden_state.shape       ,		(self.batch_size, 3, self.d_model)     )

								SCREAMING_SNAKE_CASE__     							=				False
								SCREAMING_SNAKE_CASE__     							=				TFFunnelBaseModel(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.last_hidden_state.shape       ,		(self.batch_size, 2, self.d_model)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				TFFunnelForPreTraining(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.seq_length)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				TFFunnelForMaskedLM(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.seq_length, self.vocab_size)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				self.num_labels
								SCREAMING_SNAKE_CASE__     							=				TFFunnelForSequenceClassification(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.num_labels)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				self.num_choices
								SCREAMING_SNAKE_CASE__     							=				TFFunnelForMultipleChoice(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				tf.tile(tf.expand_dims(UpperCAmelCase__       ,		1     )       ,		(1, self.num_choices, 1)     )
								SCREAMING_SNAKE_CASE__     							=				tf.tile(tf.expand_dims(UpperCAmelCase__       ,		1     )       ,		(1, self.num_choices, 1)     )
								SCREAMING_SNAKE_CASE__     							=				tf.tile(tf.expand_dims(UpperCAmelCase__       ,		1     )       ,		(1, self.num_choices, 1)     )
								SCREAMING_SNAKE_CASE__     							=				{
								    "input_ids": multiple_choice_inputs_ids,
								    "attention_mask": multiple_choice_input_mask,
								    "token_type_ids": multiple_choice_token_type_ids,
								}
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.num_choices)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				self.num_labels
								SCREAMING_SNAKE_CASE__     							=				TFFunnelForTokenClassification(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								SCREAMING_SNAKE_CASE__     							=				model(UpperCAmelCase__     )
								self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.seq_length, self.num_labels)     )



				def   lowerCAmelCase__		(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		UpperCAmelCase__       ,		):
								SCREAMING_SNAKE_CASE__     							=				TFFunnelForQuestionAnswering(config=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								SCREAMING_SNAKE_CASE__     							=				model(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     ):
								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__
								)							,      (
								    SCREAMING_SNAKE_CASE__
								)							,      
								)     							=				config_and_inputs
								SCREAMING_SNAKE_CASE__     							=				{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
								return config, inputs_dict


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





				"""simple docstring"""







				_lowerCAmelCase      :      Tuple      							=					(
				    (
				        TFFunnelModel,
				        TFFunnelForMaskedLM,
				        TFFunnelForPreTraining,
				        TFFunnelForQuestionAnswering,
				        TFFunnelForTokenClassification,
				    )
				    if is_tf_available()
				    else ()
				)
				_lowerCAmelCase      :      Any      							=					(
				    {
				        "feature-extraction": (TFFunnelBaseModel, TFFunnelModel),
				        "fill-mask": TFFunnelForMaskedLM,
				        "question-answering": TFFunnelForQuestionAnswering,
				        "text-classification": TFFunnelForSequenceClassification,
				        "token-classification": TFFunnelForTokenClassification,
				        "zero-shot": TFFunnelForSequenceClassification,
				    }
				    if is_tf_available()
				    else {}
				)
				_lowerCAmelCase      :      Dict      							=					False
				_lowerCAmelCase      :      Dict      							=					False



				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				TFFunnelModelTester(self     )
								SCREAMING_SNAKE_CASE__     							=				ConfigTester(self       ,		config_class=UpperCAmelCase__     )



				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_model(*UpperCAmelCase__     )



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



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



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






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


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





				"""simple docstring"""







				_lowerCAmelCase      :      List[Any]      							=					(
				    (TFFunnelBaseModel, TFFunnelForMultipleChoice, TFFunnelForSequenceClassification) if is_tf_available() else ()
				)
				_lowerCAmelCase      :      Optional[Any]      							=					False
				_lowerCAmelCase      :      Dict      							=					False



				def   lowerCAmelCase__		(						self     ):
								SCREAMING_SNAKE_CASE__     							=				TFFunnelModelTester(self       ,		base=UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				ConfigTester(self       ,		config_class=UpperCAmelCase__     )



				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_base_model(*UpperCAmelCase__     )



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






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




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