



'''simple docstring'''

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

from tokenizers import processors

from ...tokenization_utils import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
		from .tokenization_mbartaa import MBartaaTokenizer
else:
		_A					:     List[Any]      =None


_A					:     str      =logging.get_logger(__name__)

_A					:     Union[str, Any]      ={'''vocab_file''': '''sentencepiece.bpe.model''', '''tokenizer_file''': '''tokenizer.json'''}

_A					:     Tuple      ={
    '''vocab_file''': {
        '''facebook/mbart-large-50-one-to-many-mmt''': (
            '''https://huggingface.co/facebook/mbart-large-50-one-to-many-mmt/resolve/main/sentencepiece.bpe.model'''
        ),
    },
    '''tokenizer_file''': {
        '''facebook/mbart-large-50-one-to-many-mmt''': (
            '''https://huggingface.co/facebook/mbart-large-50-one-to-many-mmt/resolve/main/tokenizer.json'''
        ),
    },
}

_A					:     List[Any]      ={
    '''facebook/mbart-large-50-one-to-many-mmt''': 1_0_2_4,
}

# fmt: off
_A					:     Optional[int]      =['''ar_AR''', '''cs_CZ''', '''de_DE''', '''en_XX''', '''es_XX''', '''et_EE''', '''fi_FI''', '''fr_XX''', '''gu_IN''', '''hi_IN''', '''it_IT''', '''ja_XX''', '''kk_KZ''', '''ko_KR''', '''lt_LT''', '''lv_LV''', '''my_MM''', '''ne_NP''', '''nl_XX''', '''ro_RO''', '''ru_RU''', '''si_LK''', '''tr_TR''', '''vi_VN''', '''zh_CN''', '''af_ZA''', '''az_AZ''', '''bn_IN''', '''fa_IR''', '''he_IL''', '''hr_HR''', '''id_ID''', '''ka_GE''', '''km_KH''', '''mk_MK''', '''ml_IN''', '''mn_MN''', '''mr_IN''', '''pl_PL''', '''ps_AF''', '''pt_XX''', '''sv_SE''', '''sw_KE''', '''ta_IN''', '''te_IN''', '''th_TH''', '''tl_XX''', '''uk_UA''', '''ur_PK''', '''xh_ZA''', '''gl_ES''', '''sl_SI''']



class 		lowerCamelCase__   (    A  ):




					'''simple docstring'''



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

					A_         =    []
					A_         =    []




					def __init__(	self					:						List[Any]  ,	UpperCamelCase_					:						Optional[int]=None  ,	UpperCamelCase_					:						Dict=None  ,	UpperCamelCase_					:						List[Any]=None  ,	UpperCamelCase_					:						int=None  ,	UpperCamelCase_					:						List[str]="</s>"  ,	UpperCamelCase_					:						str="</s>"  ,	UpperCamelCase_					:						Optional[int]="<s>"  ,	UpperCamelCase_					:						str="<unk>"  ,	UpperCamelCase_					:						List[Any]="<pad>"  ,	UpperCamelCase_					:						Any="<mask>"  ,	**UpperCamelCase_					:						Union[str, Any]  ,	)	->							List[str]:



						'''simple docstring'''





						_lowercase       :							Optional[Any]  	=		AddedToken(UpperCamelCase_  ,	lstrip=UpperCamelCase_  ,	rstrip=UpperCamelCase_       ) if isinstance(UpperCamelCase_  ,	UpperCamelCase_       ) else mask_token

						_lowercase       :							Tuple  	=		kwargs.get('additional_special_tokens'  ,	[]       )
						kwargs["additional_special_tokens"] += [
						    code for code in FAIRSEQ_LANGUAGE_CODES if code not in kwargs["additional_special_tokens"]
						]

						super().__init__(
						    UpperCamelCase_  ,	src_lang=UpperCamelCase_  ,	tgt_lang=UpperCamelCase_  ,	tokenizer_file=UpperCamelCase_  ,	eos_token=UpperCamelCase_  ,	sep_token=UpperCamelCase_  ,	cls_token=UpperCamelCase_  ,	unk_token=UpperCamelCase_  ,	pad_token=UpperCamelCase_  ,	mask_token=UpperCamelCase_  ,	**UpperCamelCase_  ,	)

						_lowercase       :							Tuple  	=		vocab_file
						_lowercase       :							Tuple  	=		False if not self.vocab_file else True

						_lowercase       :							List[Any]  	=		{
						    lang_code: self.convert_tokens_to_ids(UpperCamelCase_       ) for lang_code in FAIRSEQ_LANGUAGE_CODES
						}

						_lowercase       :							List[Any]  	=		src_lang if src_lang is not None else 'en_XX'
						_lowercase       :							List[Any]  	=		tgt_lang
						_lowercase       :							Optional[Any]  	=		self.lang_code_to_id[self._src_lang]
						self.set_src_lang_special_tokens(self._src_lang       )




					@property
					def     __UpperCAmelCase  (	self					:						List[Any]       )	->							str:



						'''simple docstring'''





						return self._src_lang




					@src_lang.setter
					def     __UpperCAmelCase  (	self					:						List[Any]  ,	UpperCamelCase_					:						str       )	->							None:



						'''simple docstring'''





						_lowercase       :							Dict  	=		new_src_lang
						self.set_src_lang_special_tokens(self._src_lang       )




					def     __UpperCAmelCase  (	self					:						List[Any]  ,	UpperCamelCase_					:						List[int]  ,	UpperCamelCase_					:						Optional[List[int]] = None       )	->							List[int]:



						'''simple docstring'''





						if token_ids_a is None:
							return self.prefix_tokens + token_ids_a + self.suffix_tokens
						# We don't expect to process pairs, but leave the pair logic for API consistency
						return self.prefix_tokens + token_ids_a + token_ids_a + self.suffix_tokens




					def     __UpperCAmelCase  (	self					:						List[Any]  ,	UpperCamelCase_					:						List[str]  ,	UpperCamelCase_					:						str = "en_XX"  ,	UpperCamelCase_					:						Optional[List[str]] = None  ,	UpperCamelCase_					:						str = "ro_RO"  ,	**UpperCamelCase_					:						Any  ,	)	->							BatchEncoding:



						'''simple docstring'''





						_lowercase       :							List[str]  	=		src_lang
						_lowercase       :							Union[str, Any]  	=		tgt_lang
						return super().prepare_seqaseq_batch(UpperCamelCase_  ,	UpperCamelCase_  ,	**UpperCamelCase_       )




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



						'''simple docstring'''





						return self.set_src_lang_special_tokens(self.src_lang       )




					def     __UpperCAmelCase  (	self					:						Dict       )	->							Tuple:



						'''simple docstring'''





						return self.set_tgt_lang_special_tokens(self.tgt_lang       )




					def     __UpperCAmelCase  (	self					:						str  ,	UpperCamelCase_					:						str       )	->							None:



						'''simple docstring'''





						_lowercase       :							Optional[int]  	=		self.convert_tokens_to_ids(UpperCamelCase_       )
						_lowercase       :							int  	=		[self.cur_lang_code_id]
						_lowercase       :							Optional[int]  	=		[self.eos_token_id]

						_lowercase       :							Optional[Any]  	=		self.convert_ids_to_tokens(self.prefix_tokens       )
						_lowercase       :							Optional[int]  	=		self.convert_ids_to_tokens(self.suffix_tokens       )

						_lowercase       :							Tuple  	=		processors.TemplateProcessing(
						    single=prefix_tokens_str + ['$A'] + suffix_tokens_str  ,	pair=prefix_tokens_str + ['$A', '$B'] + suffix_tokens_str  ,	special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str  ,	self.prefix_tokens + self.suffix_tokens       )       )  ,	)




					def     __UpperCAmelCase  (	self					:						Optional[int]  ,	UpperCamelCase_					:						str       )	->							None:



						'''simple docstring'''





						_lowercase       :							Any  	=		self.convert_tokens_to_ids(UpperCamelCase_       )
						_lowercase       :							Any  	=		[self.cur_lang_code_id]
						_lowercase       :							List[str]  	=		[self.eos_token_id]

						_lowercase       :							Optional[int]  	=		self.convert_ids_to_tokens(self.prefix_tokens       )
						_lowercase       :							int  	=		self.convert_ids_to_tokens(self.suffix_tokens       )

						_lowercase       :							Optional[int]  	=		processors.TemplateProcessing(
						    single=prefix_tokens_str + ['$A'] + suffix_tokens_str  ,	pair=prefix_tokens_str + ['$A', '$B'] + suffix_tokens_str  ,	special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str  ,	self.prefix_tokens + self.suffix_tokens       )       )  ,	)




					def     __UpperCAmelCase  (	self					:						Optional[Any]  ,	UpperCamelCase_					:						Any  ,	UpperCamelCase_					:						str  ,	UpperCamelCase_					:						Optional[str]  ,	UpperCamelCase_					:						Optional[str]  ,	**UpperCamelCase_					:						Optional[Any]       )	->							Tuple:



						'''simple docstring'''





						if src_lang is None or tgt_lang is None:
							raise ValueError('Translation requires a `src_lang` and a `tgt_lang` for this model'       )
						_lowercase       :							Union[str, Any]  	=		src_lang
						_lowercase       :							Union[str, Any]  	=		self(UpperCamelCase_  ,	add_special_tokens=UpperCamelCase_  ,	return_tensors=UpperCamelCase_  ,	**UpperCamelCase_       )
						_lowercase       :							str  	=		self.convert_tokens_to_ids(UpperCamelCase_       )
						_lowercase       :							str  	=		tgt_lang_id
						return inputs




					def     __UpperCAmelCase  (	self					:						Tuple  ,	UpperCamelCase_					:						str  ,	UpperCamelCase_					:						Optional[str] = None       )	->							Tuple[str]:



						'''simple docstring'''





						if not self.can_save_slow_tokenizer:
							raise ValueError(
							    'Your fast tokenizer does not have the necessary information to save the vocabulary for a slow '
							    'tokenizer.'       )

						if not os.path.isdir(UpperCamelCase_       ):
							logger.error(F'''Vocabulary path ({save_directory}) should be a directory'''       )
							return
						_lowercase       :							List[Any]  	=		os.path.join(
						    UpperCamelCase_  ,	(filename_prefix + '-' if filename_prefix else '') + VOCAB_FILES_NAMES['vocab_file']       )

						if os.path.abspath(self.vocab_file       ) != os.path.abspath(UpperCamelCase_       ):
							copyfile(self.vocab_file  ,	UpperCamelCase_       )

						return (out_vocab_file,)





'''simple docstring'''

def     __UpperCamelCase					(				_lowercase = 1000       )			->      int:
	_lowercase       :							Optional[int]  	=		[0, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8]
	# number of letters in twenty, thirty, ..., ninety (0 for numbers less than
	# 20 due to inconsistency in teens)
	_lowercase       :							List[Any]  	=		[0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

	_lowercase       :							Any  	=		0

	for i in range(1,					n + 1       ):
		if i < 1000:
			if i >= 100:
				# add number of letters for "n hundred"
				count += ones_counts[i // 100] + 7

				if i % 100 != 0:
					# add number of letters for "and" if number is not multiple
					# of 100
					count += 3

			if 0 < i % 100 < 20:
				# add number of letters for one, two, three, ..., nineteen
				# (could be combined with below if not for inconsistency in
				# teens)
				count += ones_counts[i % 100]
			else:
				# add number of letters for twenty, twenty one, ..., ninety
				# nine
				count += ones_counts[i % 10]
				count += tens_counts[(i % 100 - i % 10) // 10]
		else:
			count += ones_counts[i // 1000] + 8
	return count


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