






import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple

import sentencepiece as spm

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


lowercase  :							List[Any]			  =    logging.get_logger(__name__)


lowercase  :							List[Any]			  =    "▁"

lowercase  :							Union[str, Any]			  =    {"vocab_file": "spiece.model"}

lowercase  :							List[Any]			  =    {
    "vocab_file": {
        "google/reformer-crime-and-punishment": (
            "https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/spiece.model"
        )
    }
}

lowercase  :							Optional[Any]			  =    {
    "google/reformer-crime-and-punishment": 52_42_88,
}




class 		UpperCAmelCase_						(	__UpperCAmelCase					):


						'''simple docstring'''




						A     :   Optional[int]						=					VOCAB_FILES_NAMES
						A     :   Dict						=					PRETRAINED_VOCAB_FILES_MAP
						A     :   List[Any]						=					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
						A     :   Any						=					['input_ids', 'attention_mask']






						def __init__(	self		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE="</s>"		,				_SCREAMING_SNAKE_CASE="<unk>"		,				_SCREAMING_SNAKE_CASE=[]		,				_SCREAMING_SNAKE_CASE = None		,				**_SCREAMING_SNAKE_CASE		,				) ->				Union[str, Any]:
								snake_case_				:							Dict						 =       {} if sp_model_kwargs is None else sp_model_kwargs

								super().__init__(
								    eos_token=lowerCAmelCase_		,				unk_token=lowerCAmelCase_		,				additional_special_tokens=lowerCAmelCase_		,				sp_model_kwargs=self.sp_model_kwargs		,				**lowerCAmelCase_		,				)

								snake_case_				:							int						 =       vocab_file
								snake_case_				:							str						 =       spm.SentencePieceProcessor(**self.sp_model_kwargs				)
								self.sp_model.Load(lowerCAmelCase_				)






						@property
						def       _lowerCAmelCase       (	self				) ->				Tuple:
								return self.sp_model.get_piece_size()






						def       _lowerCAmelCase       (	self				) ->				Tuple:
								snake_case_				:							str						 =       {self.convert_ids_to_tokens(lowerCAmelCase_				): i for i in range(self.vocab_size				)}
								vocab.update(self.added_tokens_encoder				)
								return vocab






						def __getstate__(	self				) ->				Union[str, Any]:
								snake_case_				:							Tuple						 =       self.__dict__.copy()
								snake_case_				:							Dict						 =       None
								return state






						def __setstate__(	self		,				_SCREAMING_SNAKE_CASE				) ->				Optional[Any]:
								snake_case_				:							List[str]						 =       d

								# for backward compatibility
								if not hasattr(self		,				"sp_model_kwargs"				):
										snake_case_				:							Dict						 =       {}

								snake_case_				:							Optional[int]						 =       spm.SentencePieceProcessor(**self.sp_model_kwargs				)
								self.sp_model.Load(self.vocab_file				)






						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE				) ->				Union[str, Any]:
								return self.sp_model.encode(lowerCAmelCase_		,				out_type=lowerCAmelCase_				)






						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE				) ->				List[Any]:
								return self.sp_model.piece_to_id(lowerCAmelCase_				)






						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE				) ->				Optional[Any]:







								if index < self.sp_model.get_piece_size():
										snake_case_				:							Union[str, Any]						 =       self.sp_model.IdToPiece(lowerCAmelCase_				)
								return token






						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE				) ->				Any:
								snake_case_				:							Any						 =       []
								snake_case_				:							int						 =       ""
								for token in tokens:
										# make sure that special tokens are not decoded using sentencepiece model
										if token in self.all_special_tokens:
												out_string += self.sp_model.decode(lowerCAmelCase_				) + token
												snake_case_				:							List[Any]						 =       []
										else:
												current_sub_tokens.append(lowerCAmelCase_				)
								out_string += self.sp_model.decode(lowerCAmelCase_				)
								return out_string.strip()






						def       _lowerCAmelCase       (	self		,				_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE = None				) ->				Optional[int]:







								if not os.path.isdir(lowerCAmelCase_				):
										logger.error(f'''Vocabulary path ({save_directory}) should be a directory'''				)
										return
								snake_case_				:							Optional[Any]						 =       os.path.join(
								    lowerCAmelCase_		,				(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]				)

								if os.path.abspath(self.vocab_file				) != os.path.abspath(lowerCAmelCase_				) and os.path.isfile(self.vocab_file				):
										copyfile(self.vocab_file		,				lowerCAmelCase_				)
								elif not os.path.isfile(self.vocab_file				):
										with open(lowerCAmelCase_		,				"wb"				) as fi:
												snake_case_				:							Any						 =       self.sp_model.serialized_model_proto()
												fi.write(lowerCAmelCase_				)

								return (out_vocab_file,)








def      lowerCAmelCase__	(    _a       :			int    ):
		snake_case_				:							str						 =       1
		for i in range(1  ,      num + 1    ):
				fact *= i
		return fact

def      lowerCAmelCase__	(    _a       :			int    ):
		snake_case_				:							List[str]						 =       0
		while number > 0:
				snake_case_				:							Dict						 =       number % 10
				sum_of_digits += last_digit
				snake_case_				:							List[Any]						 =       number // 10  # Removing the last_digit from the given number
		return sum_of_digits

def      lowerCAmelCase__	(    _a       :			int = 1_00    ):
		snake_case_				:							Optional[Any]						 =       factorial(_a    )
		snake_case_				:							Optional[int]						 =       split_and_add(_a    )
		return result


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