




"""simple docstring"""

import os
import re
import unicodedata
from shutil import copyfile
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union

import sentencepiece as spm

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import is_torch_available, logging


if is_torch_available():
							import torch


if TYPE_CHECKING:
							from transformers.pipelines.conversational import Conversation


__A       						=	logging.get_logger(__name__)
__A       						=	{'vocab_file': 'spiece.model'}

__A       						=	{
    'vocab_file': {
        'AI-Sweden/gpt-sw3-126m': 'https://huggingface.co/AI-Sweden/gpt-sw3-126m/resolve/main/spiece.model',
        'AI-Sweden/gpt-sw3-350m': 'https://huggingface.co/AI-Sweden/gpt-sw3-350m/resolve/main/spiece.model',
        'AI-Sweden/gpt-sw3-1.6b': 'https://huggingface.co/AI-Sweden/gpt-sw3-1.6b/resolve/main/spiece.model',
        'AI-Sweden/gpt-sw3-6.7b': 'https://huggingface.co/AI-Sweden/gpt-sw3-6.7b/resolve/main/spiece.model',
        'AI-Sweden/gpt-sw3-20b': 'https://huggingface.co/AI-Sweden/gpt-sw3-20b/resolve/main/spiece.model',
    }
}

__A       						=	{
    'AI-Sweden/gpt-sw3-126m': 2_048,
    'AI-Sweden/gpt-sw3-350m': 2_048,
    'AI-Sweden/gpt-sw3-1.6b': 2_048,
    'AI-Sweden/gpt-sw3-6.7b': 2_048,
    'AI-Sweden/gpt-sw3-20b': 2_048,
}
class 	lowerCamelCase__			(     __SCREAMING_SNAKE_CASE	):
			a__       :					Any	    =   VOCAB_FILES_NAMES
			a__       :					List[Any]	    =   PRETRAINED_VOCAB_FILES_MAP
			a__       :					Dict	    =   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
			a__       :					Optional[int]	    =   ["""input_ids""", """attention_mask"""]


			def __init__(   self ,       SCREAMING_SNAKE_CASE ,       SCREAMING_SNAKE_CASE=False ,       SCREAMING_SNAKE_CASE=False ,       SCREAMING_SNAKE_CASE=False ,       SCREAMING_SNAKE_CASE=None ,       SCREAMING_SNAKE_CASE=None ,       SCREAMING_SNAKE_CASE=None ,       SCREAMING_SNAKE_CASE=None ,       SCREAMING_SNAKE_CASE = None ,       **SCREAMING_SNAKE_CASE ,       ):



					"""simple docstring"""







					snake_case						:  int    	= {} if sp_model_kwargs is None else sp_model_kwargs

					snake_case						:  Dict    	= kwargs.get("name_or_path"							)
					if name_or_path is None:
							logger.warning(
							    "name_or_path not provided, will work for all GPTSw3 models except gpt-sw3-7b,"
							    " you are testing the model, this can safely be ignored"							)
							snake_case						:  List[str]    	= "None"

					# Default definitions for our 2 tokenizer versions, with None-checks to enable proper testing
					snake_case						:  int    	= "<|endoftext|>" if eos_token is None else eos_token
					snake_case						:  Tuple    	= "<unk>" if unk_token is None else unk_token
					if "gpt-sw3-7b" in name_or_path:
							snake_case						:  List[str]    	= unk_token if pad_token is None else pad_token
							snake_case						:  List[str]    	= eos_token if bos_token is None else bos_token
					else:
							snake_case						:  Optional[int]    	= "<pad>" if pad_token is None else pad_token
							snake_case						:  List[Any]    	= "<s>" if bos_token is None else bos_token

					super().__init__(
					    do_lower_case=_SCREAMING_SNAKE_CASE ,       remove_space=_SCREAMING_SNAKE_CASE ,       keep_accents=_SCREAMING_SNAKE_CASE ,       bos_token=_SCREAMING_SNAKE_CASE ,       eos_token=_SCREAMING_SNAKE_CASE ,       unk_token=_SCREAMING_SNAKE_CASE ,       pad_token=_SCREAMING_SNAKE_CASE ,       sp_model_kwargs=self.sp_model_kwargs ,       **_SCREAMING_SNAKE_CASE ,       )

					snake_case						:  Any    	= do_lower_case
					snake_case						:  str    	= remove_space
					snake_case						:  Tuple    	= keep_accents
					snake_case						:  List[Any]    	= vocab_file

					snake_case						:  Dict    	= spm.SentencePieceProcessor(**self.sp_model_kwargs							)
					self.sp_model.Load(_SCREAMING_SNAKE_CASE							)

					# Used for whitespace normalization in input texts
					# fmt : off
					snake_case						:  Any    	= {" ", " ", " ", " ", " ", "　", " ", " ", " ", " ", "￼", ""}
					# fmt : on

					# Regular expression to remove non-printing characters (e.g. some unicode control chars) in preprocessing
					snake_case						:  Dict    	= re.compile(
					    F'''[{''.join(map(_SCREAMING_SNAKE_CASE ,       list(range(0 ,       9							)							) + list(range(11 ,       32							)							) + list(range(127 ,       160							)							) + [160, 173, 8_203]							)							)}]'''							)


			def __getstate__(   self							):



					"""simple docstring"""







					snake_case						:  Optional[int]    	= self.__dict__.copy()
					snake_case						:  Tuple    	= None
					return state


			def __setstate__(   self ,       SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[Any]    	= d

					# for backward compatibility
					if not hasattr(self ,       "sp_model_kwargs"							):
							snake_case						:  Union[str, Any]    	= {}

					snake_case						:  str    	= spm.SentencePieceProcessor(**self.sp_model_kwargs							)
					self.sp_model.Load(self.vocab_file							)


			@property
			# Copied from transformers.models.albert.tokenization_albert.AlbertTokenizer.vocab_size
			def 							lowerCamelCase_ (   self							):



					"""simple docstring"""







					return len(self.sp_model							)


			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[int]    	= self.non_printing_characters_re.sub("" ,       _SCREAMING_SNAKE_CASE							)

					# Normalize whitespaces
					snake_case						:  List[Any]    	= "".join([char if char not in self.whitespaces else " " for char in text]							)

					# NFC Unicode normalization
					snake_case						:  Dict    	= unicodedata.normalize("NFC" ,       _SCREAMING_SNAKE_CASE							)
					return text


			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE ,       **SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Dict    	= self.preprocess_text(_SCREAMING_SNAKE_CASE							)
					return self.sp_model.encode(_SCREAMING_SNAKE_CASE ,       out_type=_SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					return self.sp_model.PieceToId(_SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					return self.sp_model.IdToPiece(_SCREAMING_SNAKE_CASE							)


			@staticmethod
			def 							lowerCamelCase_ (   SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					return out_string


			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[Any]    	= []
					snake_case						:  str    	= ""
					snake_case						:  List[str]    	= False
					for token in tokens:
							# make sure that special tokens are not decoded using sentencepiece model
							if token in self.all_special_tokens:
									# TODO: Check if this is needed, as it ensures that decode(encode(doc)) != doc by adding extra whitespace in the decoded document
									if not prev_is_special:
											out_string += " "

									out_string += self.sp_model.decode(_SCREAMING_SNAKE_CASE							) + token
									snake_case						:  Dict    	= True
									snake_case						:  Optional[Any]    	= []
							else:
									current_sub_tokens.append(_SCREAMING_SNAKE_CASE							)
									snake_case						:  List[str]    	= False
					out_string += self.sp_model.decode(_SCREAMING_SNAKE_CASE							)

					return out_string


			def 							lowerCamelCase_ (   self							):



					"""simple docstring"""







					snake_case						:  List[str]    	= {self.convert_ids_to_tokens(_SCREAMING_SNAKE_CASE							): i for i in range(self.vocab_size							)}
					vocab.update(self.added_tokens_encoder							)
					return vocab


			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE ,       SCREAMING_SNAKE_CASE = None							):



					"""simple docstring"""







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

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

					return (out_vocab_file,)


			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE ,       SCREAMING_SNAKE_CASE = False							):



					"""simple docstring"""







					if isinstance(_SCREAMING_SNAKE_CASE ,       _SCREAMING_SNAKE_CASE							):
							snake_case						:  str    	= self.preprocess_text(_SCREAMING_SNAKE_CASE							)
							snake_case						:  Tuple    	= self.sp_model.encode(_SCREAMING_SNAKE_CASE							)
					else:
							snake_case						:  Optional[Any]    	= [self.preprocess_text(_SCREAMING_SNAKE_CASE							) for t in text]
							snake_case						:  Optional[int]    	= self.sp_model.encode(_SCREAMING_SNAKE_CASE							)

					if return_tensors is True or return_tensors == "pt":
							snake_case						:  Optional[int]    	= torch.tensor(_SCREAMING_SNAKE_CASE							)

					return token_ids


			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					return self.sp_model.decode(_SCREAMING_SNAKE_CASE							)



			def 							lowerCamelCase_ (   self ,       SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[Any]    	= [F'''User: {text}''' if is_user else F'''Bot: {text}''' for is_user, text in conversation.iter_texts()]
					snake_case						:  int    	= (
					    F'''{self.eos_token}{self.bos_token}''' + F'''{self.bos_token}'''.join(_SCREAMING_SNAKE_CASE							) + F'''{self.bos_token}Bot:'''
					)
					return self.encode(text=_SCREAMING_SNAKE_CASE							)






"""simple docstring"""






def 			_lowercase				(  )						->   int:
			return 1


def 			_lowercase				(  __snake_case	)						->   int:
			return 0 if x < 0 else two_pence(x - 2	) + one_pence()


def 			_lowercase				(  __snake_case	)						->   int:
			return 0 if x < 0 else five_pence(x - 5	) + two_pence(__snake_case	)


def 			_lowercase				(  __snake_case	)						->   int:
			return 0 if x < 0 else ten_pence(x - 10	) + five_pence(__snake_case	)


def 			_lowercase				(  __snake_case	)						->   int:
			return 0 if x < 0 else twenty_pence(x - 20	) + ten_pence(__snake_case	)


def 			_lowercase				(  __snake_case	)						->   int:
			return 0 if x < 0 else fifty_pence(x - 50	) + twenty_pence(__snake_case	)


def 			_lowercase				(  __snake_case	)						->   int:
			return 0 if x < 0 else one_pound(x - 100	) + fifty_pence(__snake_case	)


def 			_lowercase				(  __snake_case	)						->   int:
			return 0 if x < 0 else two_pound(x - 200	) + one_pound(__snake_case	)


def 			_lowercase				(  __snake_case = 200	)						->   int:
			return two_pound(__snake_case	)


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