
'''simple docstring'''
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


A__   :		str 		=logging.get_logger(__name__)

A__   :		Union[str, Any] 		={'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

A__   :		List[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',
    },
}

A__   :		Tuple 		={
    'gpt2': 1_024,
    'gpt2-medium': 1_024,
    'gpt2-large': 1_024,
    'gpt2-xl': 1_024,
    'distilgpt2': 1_024,
}







class  __A				( _SCREAMING_SNAKE_CASE			):
 lowerCamelCase				       =VOCAB_FILES_NAMES
 lowerCamelCase				       =PRETRAINED_VOCAB_FILES_MAP
 lowerCamelCase				       =PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 lowerCamelCase				       =['''input_ids''', '''attention_mask''']
 lowerCamelCase				       =GPTaTokenizer
 def __init__(   self			:    str				,   lowerCamelCase			:    Union[str, Any]=None				,   lowerCamelCase			:    Union[str, Any]=None				,   lowerCamelCase			:    str=None				,   lowerCamelCase			:    Any="<|endoftext|>"				,   lowerCamelCase			:    Dict="<|endoftext|>"				,   lowerCamelCase			:    Optional[int]="<|endoftext|>"				,   lowerCamelCase			:    Union[str, Any]=False				,   **lowerCamelCase			:    str				,   ):



   """simple docstring"""





   super().__init__(
       lowerCamelCase				,   lowerCamelCase				,   tokenizer_file=lowerCamelCase				,   unk_token=lowerCamelCase				,   bos_token=lowerCamelCase				,   eos_token=lowerCamelCase				,   add_prefix_space=lowerCamelCase				,   **lowerCamelCase				,   )

   __A		:     List[str]												=		kwargs.pop("""add_bos_token"""				,   lowerCamelCase       )

   __A		:     int												=		json.loads(self.backend_tokenizer.pre_tokenizer.__getstate__()       )
   if pre_tok_state.get("""add_prefix_space"""				,   lowerCamelCase       ) != add_prefix_space:
     __A		:     Any												=		getattr(lowerCamelCase				,   pre_tok_state.pop("""type"""       )       )
     __A		:     Tuple												=		add_prefix_space
     __A		:     Dict												=		pre_tok_class(**lowerCamelCase       )

   __A		:     str												=		add_prefix_space
 def 		lowercase_(   self			:    Tuple				,   *lowerCamelCase			:    List[Any]				,   **lowerCamelCase			:    List[str]       ):



   """simple docstring"""





   __A		:     List[Any]												=		kwargs.get("""is_split_into_words"""				,   lowerCamelCase       )
   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(*lowerCamelCase				,   **lowerCamelCase       )
 def 		lowercase_(   self			:    Union[str, Any]				,   *lowerCamelCase			:    List[str]				,   **lowerCamelCase			:    List[str]       ):



   """simple docstring"""





   __A		:     str												=		kwargs.get("""is_split_into_words"""				,   lowerCamelCase       )

   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(*lowerCamelCase				,   **lowerCamelCase       )
 def 		lowercase_(   self			:    Union[str, Any]				,   lowerCamelCase			:    str				,   lowerCamelCase			:    Optional[str] = None       ):



   """simple docstring"""





   __A		:     Optional[int]												=		self._tokenizer.model.save(lowerCamelCase				,   name=lowerCamelCase       )
   return tuple(lowerCamelCase       )






 def 		lowercase_(   self			:    Optional[int]				,   lowerCamelCase			:    "Conversation"       ):



   """simple docstring"""





   __A		:     Optional[int]												=		[]
   for is_user, text in conversation.iter_texts():
     input_ids.extend(self.encode(lowerCamelCase				,   add_special_tokens=lowerCamelCase       ) + [self.eos_token_id]       )

   if len(lowerCamelCase       ) > self.model_max_length:
     __A		:     Optional[int]												=		input_ids[-self.model_max_length :]
   return input_ids





'''simple docstring'''
def        A_     (						__SCREAMING_SNAKE_CASE						:  int )				->       int:





  """simple docstring"""

  __A		:     Optional[int]												=		1
  for i in range(1			,     num + 1 ):
    fact *= i
  return fact







def        A_     (						__SCREAMING_SNAKE_CASE						:  int )				->       int:





  """simple docstring"""

  __A		:     List[str]												=		0
  while number > 0:
    __A		:     Union[str, Any]												=		number % 10
    sum_of_digits += last_digit
    __A		:     int												=		number // 10  # Removing the last_digit from the given number
  return sum_of_digits







def        A_     (						__SCREAMING_SNAKE_CASE						:  int = 100 )				->       int:





  """simple docstring"""

  __A		:     Union[str, Any]												=		factorial(__SCREAMING_SNAKE_CASE )
  __A		:     Any												=		split_and_add(__SCREAMING_SNAKE_CASE )
  return result


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



