






import json
from typing import TYPE_CHECKING, List, Optional, Tuple

from tokenizers import pre_tokenizers

from ...tokenization_utils_base import BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_gpta import GPTaTokenizer


if TYPE_CHECKING:
 from transformers.pipelines.conversational import Conversation


snake_case__   :						Optional[Any]													=   logging.get_logger(__name__)

snake_case__   :						List[str]													=   {"""vocab_file""": """vocab.json""", """merges_file""": """merges.txt""", """tokenizer_file""": """tokenizer.json"""}

snake_case__   :						str													=   {
    """vocab_file""": {
        """gpt2""": """https://huggingface.co/gpt2/resolve/main/vocab.json""",
        """gpt2-medium""": """https://huggingface.co/gpt2-medium/resolve/main/vocab.json""",
        """gpt2-large""": """https://huggingface.co/gpt2-large/resolve/main/vocab.json""",
        """gpt2-xl""": """https://huggingface.co/gpt2-xl/resolve/main/vocab.json""",
        """distilgpt2""": """https://huggingface.co/distilgpt2/resolve/main/vocab.json""",
    },
    """merges_file""": {
        """gpt2""": """https://huggingface.co/gpt2/resolve/main/merges.txt""",
        """gpt2-medium""": """https://huggingface.co/gpt2-medium/resolve/main/merges.txt""",
        """gpt2-large""": """https://huggingface.co/gpt2-large/resolve/main/merges.txt""",
        """gpt2-xl""": """https://huggingface.co/gpt2-xl/resolve/main/merges.txt""",
        """distilgpt2""": """https://huggingface.co/distilgpt2/resolve/main/merges.txt""",
    },
    """tokenizer_file""": {
        """gpt2""": """https://huggingface.co/gpt2/resolve/main/tokenizer.json""",
        """gpt2-medium""": """https://huggingface.co/gpt2-medium/resolve/main/tokenizer.json""",
        """gpt2-large""": """https://huggingface.co/gpt2-large/resolve/main/tokenizer.json""",
        """gpt2-xl""": """https://huggingface.co/gpt2-xl/resolve/main/tokenizer.json""",
        """distilgpt2""": """https://huggingface.co/distilgpt2/resolve/main/tokenizer.json""",
    },
}

snake_case__   :						Optional[int]													=   {
    """gpt2""": 1_0_2_4,
    """gpt2-medium""": 1_0_2_4,
    """gpt2-large""": 1_0_2_4,
    """gpt2-xl""": 1_0_2_4,
    """distilgpt2""": 1_0_2_4,
}


class     _a							(	UpperCAmelCase__     ):






  """simple docstring"""





  A_						       = VOCAB_FILES_NAMES
  A_						       = PRETRAINED_VOCAB_FILES_MAP
  A_						       = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  A_						       = ["""input_ids""", """attention_mask"""]
  A_						       = GPTaTokenizer




  def __init__(  self		,		_UpperCAmelCase=None		,		_UpperCAmelCase=None		,		_UpperCAmelCase=None		,		_UpperCAmelCase="<|endoftext|>"		,		_UpperCAmelCase="<|endoftext|>"		,		_UpperCAmelCase="<|endoftext|>"		,		_UpperCAmelCase=False		,		**_UpperCAmelCase		,		)      ->			Union[str, Any]:
     super().__init__(
         _UpperCAmelCase		,		_UpperCAmelCase		,		tokenizer_file=_UpperCAmelCase		,		unk_token=_UpperCAmelCase		,		bos_token=_UpperCAmelCase		,		eos_token=_UpperCAmelCase		,		add_prefix_space=_UpperCAmelCase		,		**_UpperCAmelCase		,		)

     UpperCamelCase_						=  kwargs.pop('add_bos_token'		,		_UpperCAmelCase			)

     UpperCamelCase_						=  json.loads(self.backend_tokenizer.pre_tokenizer.__getstate__()			)
     if pre_tok_state.get('add_prefix_space'		,		_UpperCAmelCase			) != add_prefix_space:
        UpperCamelCase_						=  getattr(_UpperCAmelCase		,		pre_tok_state.pop('type'			)			)
        UpperCamelCase_						=  add_prefix_space
        UpperCamelCase_						=  pre_tok_class(**_UpperCAmelCase			)

     UpperCamelCase_						=  add_prefix_space




  def  _UpperCAmelCase  (  self		,		*_UpperCAmelCase		,		**_UpperCAmelCase			)      ->			BatchEncoding:
     UpperCamelCase_						=  kwargs.get('is_split_into_words'		,		_UpperCAmelCase			)
     assert self.add_prefix_space or not is_split_into_words, (
         f"""You need to instantiate {self.__class__.__name__} with add_prefix_space=True """
         "to use it with pretokenized inputs."
     )

     return super()._batch_encode_plus(*_UpperCAmelCase		,		**_UpperCAmelCase			)




  def  _UpperCAmelCase  (  self		,		*_UpperCAmelCase		,		**_UpperCAmelCase			)      ->			BatchEncoding:
     UpperCamelCase_						=  kwargs.get('is_split_into_words'		,		_UpperCAmelCase			)

     assert self.add_prefix_space or not is_split_into_words, (
         f"""You need to instantiate {self.__class__.__name__} with add_prefix_space=True """
         "to use it with pretokenized inputs."
     )

     return super()._encode_plus(*_UpperCAmelCase		,		**_UpperCAmelCase			)




  def  _UpperCAmelCase  (  self		,		_UpperCAmelCase		,		_UpperCAmelCase = None			)      ->			Tuple[str]:
     UpperCamelCase_						=  self._tokenizer.model.save(_UpperCAmelCase		,		name=_UpperCAmelCase			)
     return tuple(_UpperCAmelCase			)




  def  _UpperCAmelCase  (  self		,		_UpperCAmelCase			)      ->			List[int]:
     UpperCamelCase_						=  []
     for is_user, text in conversation.iter_texts():
        input_ids.extend(self.encode(_UpperCAmelCase		,		add_special_tokens=_UpperCAmelCase			) + [self.eos_token_id]			)

     if len(_UpperCAmelCase			) > self.model_max_length:
        UpperCamelCase_						=  input_ids[-self.model_max_length :]
     return input_ids













def      _snake_case     (__lowercase):
   UpperCamelCase_						=  1
   for i in range(1     ,   num + 1):
      fact *= i
   return fact






def      _snake_case     (__lowercase):
   UpperCamelCase_						=  0
   while number > 0:
      UpperCamelCase_						=  number % 10
      sum_of_digits += last_digit
      UpperCamelCase_						=  number // 10  # Removing the last_digit from the given number
   return sum_of_digits






def      _snake_case     (__lowercase = 100):
   UpperCamelCase_						=  factorial(__lowercase)
   UpperCamelCase_						=  split_and_add(__lowercase)
   return result


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





