





import unittest

from transformers import BigBirdConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
  import jax

  from transformers.models.big_bird.modeling_flax_big_bird import (
      FlaxBigBirdForCausalLM,
      FlaxBigBirdForMaskedLM,
      FlaxBigBirdForMultipleChoice,
      FlaxBigBirdForPreTraining,
      FlaxBigBirdForQuestionAnswering,
      FlaxBigBirdForSequenceClassification,
      FlaxBigBirdForTokenClassification,
      FlaxBigBirdModel,
  )


class        UpperCamelCase_					(				unittest.TestCase  ):

    '''simple docstring'''






    def __init__(    self   :			List[str]      ,				UpperCAmelCase__   :			Optional[Any]      ,				UpperCAmelCase__   :			Tuple=2      ,				UpperCAmelCase__   :			str=56      ,				UpperCAmelCase__   :			Any=True      ,				UpperCAmelCase__   :			Dict=True      ,				UpperCAmelCase__   :			Optional[int]=True      ,				UpperCAmelCase__   :			int=True      ,				UpperCAmelCase__   :			List[str]=99      ,				UpperCAmelCase__   :			Union[str, Any]=32      ,				UpperCAmelCase__   :			int=2      ,				UpperCAmelCase__   :			Dict=2      ,				UpperCAmelCase__   :			Optional[int]=7      ,				UpperCAmelCase__   :			Optional[Any]="gelu_new"      ,				UpperCAmelCase__   :			List[str]=0.1      ,				UpperCAmelCase__   :			List[str]=0.1      ,				UpperCAmelCase__   :			List[Any]=512      ,				UpperCAmelCase__   :			Dict=16      ,				UpperCAmelCase__   :			Optional[int]=2      ,				UpperCAmelCase__   :			int=0.02      ,				UpperCAmelCase__   :			Union[str, Any]=4      ,				UpperCAmelCase__   :			List[Any]="block_sparse"      ,				UpperCAmelCase__   :			List[Any]=True      ,				UpperCAmelCase__   :			Any=False      ,				UpperCAmelCase__   :			List[Any]=2      ,				UpperCAmelCase__   :			List[Any]=3      ,				)		->Dict:





           '''simple docstring'''

           A__   				=					parent
           A__   				=					batch_size
           A__   				=					seq_length
           A__   				=					is_training
           A__   				=					use_attention_mask
           A__   				=					use_token_type_ids
           A__   				=					use_labels
           A__   				=					vocab_size
           A__   				=					hidden_size
           A__   				=					num_hidden_layers
           A__   				=					num_attention_heads
           A__   				=					intermediate_size
           A__   				=					hidden_act
           A__   				=					hidden_dropout_prob
           A__   				=					attention_probs_dropout_prob
           A__   				=					max_position_embeddings
           A__   				=					type_vocab_size
           A__   				=					type_sequence_label_size
           A__   				=					initializer_range
           A__   				=					num_choices

           A__   				=					rescale_embeddings
           A__   				=					attention_type
           A__   				=					use_bias
           A__   				=					block_size
           A__   				=					num_random_blocks


    def  SCREAMING_SNAKE_CASE							(    self   :			List[str])		->Union[str, Any]:





           '''simple docstring'''

           A__   				=					ids_tensor([self.batch_size, self.seq_length]      ,				self.vocab_size)

           A__   				=					None
           if self.use_attention_mask:
                  A__   				=					random_attention_mask([self.batch_size, self.seq_length])

           A__   				=					None
           if self.use_token_type_ids:
                  A__   				=					ids_tensor([self.batch_size, self.seq_length]      ,				self.type_vocab_size)

           A__   				=					BigBirdConfig(
               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      ,				type_vocab_size=self.type_vocab_size      ,				is_decoder=UpperCAmelCase__      ,				initializer_range=self.initializer_range      ,				attention_type=self.attention_type      ,				block_size=self.block_size      ,				num_random_blocks=self.num_random_blocks      ,				use_bias=self.use_bias      ,				rescale_embeddings=self.rescale_embeddings      ,				)

           return config, input_ids, token_type_ids, attention_mask





    def  SCREAMING_SNAKE_CASE							(    self   :			Optional[int])		->Dict:





           '''simple docstring'''

           A__   				=					self.prepare_config_and_inputs()
           A__				,							A__				,							A__				,							A__   				=					config_and_inputs
           A__   				=					{
               '''input_ids''': input_ids,
               '''token_type_ids''': token_type_ids,
               '''attention_mask''': attention_mask,
           }
           return config, inputs_dict


@require_flax
class        UpperCamelCase_					(				UpperCAmelCase__	,      unittest.TestCase  ):

    '''simple docstring'''






    UpperCAmelCase__													=   (
        (
            FlaxBigBirdForCausalLM,
            FlaxBigBirdModel,
            FlaxBigBirdForPreTraining,
            FlaxBigBirdForMaskedLM,
            FlaxBigBirdForMultipleChoice,
            FlaxBigBirdForQuestionAnswering,
            FlaxBigBirdForSequenceClassification,
            FlaxBigBirdForTokenClassification,
        )
        if is_flax_available()
        else ()
    )

    UpperCAmelCase__													=   False
    UpperCAmelCase__													=   False


    def  SCREAMING_SNAKE_CASE							(    self   :			Dict)		->List[Any]:





           '''simple docstring'''

           A__   				=					FlaxBigBirdModelTester(self)


    @slow
    # copied from `test_modeling_flax_common` because it takes much longer than other models
    def  SCREAMING_SNAKE_CASE							(    self   :			Union[str, Any])		->Union[str, Any]:





           '''simple docstring'''

           super().test_from_pretrained_save_pretrained()


    @slow
    # copied from `test_modeling_flax_common` because it takes much longer than other models
    def  SCREAMING_SNAKE_CASE							(    self   :			List[Any])		->Any:





           '''simple docstring'''

           super().test_from_pretrained_with_no_automatic_init()


    @slow
    # copied from `test_modeling_flax_common` because it takes much longer than other models
    def  SCREAMING_SNAKE_CASE							(    self   :			Optional[int])		->Union[str, Any]:





           '''simple docstring'''

           super().test_no_automatic_init()


    @slow
    # copied from `test_modeling_flax_common` because it takes much longer than other models
    def  SCREAMING_SNAKE_CASE							(    self   :			List[str])		->List[Any]:





           '''simple docstring'''

           super().test_hidden_states_output()


    @slow
    def  SCREAMING_SNAKE_CASE							(    self   :			Optional[Any])		->List[Any]:





           '''simple docstring'''

           for model_class_name in self.all_model_classes:
                  A__   				=					model_class_name.from_pretrained('''google/bigbird-roberta-base''')
                  self.assertIsNotNone(UpperCAmelCase__)


    def  SCREAMING_SNAKE_CASE							(    self   :			Dict)		->Dict:





           '''simple docstring'''

           if self.test_attn_probs:
                  super().test_attention_outputs()


    @slow
    # copied from `test_modeling_flax_common` because it takes much longer than other models
    def  SCREAMING_SNAKE_CASE							(    self   :			Dict)		->Dict:





           '''simple docstring'''

           A__				,							A__   				=					self.model_tester.prepare_config_and_inputs_for_common()

           for model_class in self.all_model_classes:
                  with self.subTest(model_class.__name__):
                         A__   				=					self._prepare_for_class(UpperCAmelCase__      ,				UpperCAmelCase__)
                         A__   				=					model_class(UpperCAmelCase__)

                         @jax.jit
                         def model_jitted(UpperCAmelCase__   :			Optional[int]      ,				UpperCAmelCase__   :			Optional[Any]=None      ,				**UpperCAmelCase__   :			str):
                                return model(input_ids=UpperCAmelCase__      ,				attention_mask=UpperCAmelCase__      ,				**UpperCAmelCase__)

                         with self.subTest('''JIT Enabled'''):
                                A__   				=					model_jitted(**UpperCAmelCase__).to_tuple()

                         with self.subTest('''JIT Disabled'''):
                                with jax.disable_jit():
                                       A__   				=					model_jitted(**UpperCAmelCase__).to_tuple()

                         self.assertEqual(len(UpperCAmelCase__)      ,				len(UpperCAmelCase__))
                         for jitted_output, output in zip(UpperCAmelCase__      ,				UpperCAmelCase__):
                                self.assertEqual(jitted_output.shape      ,				output.shape)





    def  SCREAMING_SNAKE_CASE							(    self   :			str      ,				UpperCAmelCase__   :			List[str]      ,				UpperCAmelCase__   :			int      ,				UpperCAmelCase__   :			Any      ,				UpperCAmelCase__   :			List[Any]=1e-5      ,				UpperCAmelCase__   :			Optional[int]="outputs"      ,				UpperCAmelCase__   :			Optional[Any]=None)		->Optional[int]:





           '''simple docstring'''

           if name.startswith('''outputs.attentions'''):
                  return
           else:
                  super().check_pt_flax_outputs(UpperCAmelCase__      ,				UpperCAmelCase__      ,				UpperCAmelCase__      ,				UpperCAmelCase__      ,				UpperCAmelCase__      ,				UpperCAmelCase__)








def SCREAMING_SNAKE_CASE       ( lowercase_		)     -> int:



       """simple docstring"""

       A__   				=					1
       for i in range(1				,       num + 1		):
              fact *= i
       return fact







def SCREAMING_SNAKE_CASE       ( lowercase_		)     -> int:



       """simple docstring"""

       A__   				=					0
       while number > 0:
              A__   				=					number % 10
              sum_of_digits += last_digit
              A__   				=					number // 10  # Removing the last_digit from the given number
       return sum_of_digits







def SCREAMING_SNAKE_CASE       ( lowercase_ = 100		)     -> int:



       """simple docstring"""

       A__   				=					factorial(lowercase_		)
       A__   				=					split_and_add(lowercase_		)
       return result


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


