

import inspect
import json
import os
import tempfile
import unittest

from transformers.models.speech_to_text_a import SpeechaTextaTokenizer
from transformers.models.speech_to_text_a.tokenization_speech_to_text_a import VOCAB_FILES_NAMES

from ...test_tokenization_common import TokenizerTesterMixin






class 				A_					(						snake_case__				,      unittest.TestCase   ):
     _lowercase     :	int        =      SpeechaTextaTokenizer
     _lowercase     :	Optional[Any]        =      False


     def     UpperCAmelCase    (				self     :						List[str]   )				->      List[str]:
      super().setUp()

      __lowerCAmelCase:  Dict        = '<s> <pad> </s> <unk> here@@ a couple of@@ words for the he@@ re@@ vocab'.split(' '   )
      __lowerCAmelCase:  Optional[Any]        = ['he re</w> 123', 'here a 1456']
      __lowerCAmelCase:  List[str]        = dict(zip(UpperCAmelCase     ,    range(len(UpperCAmelCase   )   )   )   )

      __lowerCAmelCase:  str        = {'pad_token': '<pad>', 'unk_token': '<unk>', 'bos_token': '<s>', 'eos_token': '</s>'}

      __lowerCAmelCase:  int        = tempfile.mkdtemp()
      __lowerCAmelCase:  Union[str, Any]        = os.path.join(self.tmpdirname     ,    VOCAB_FILES_NAMES['vocab_file']   )
      __lowerCAmelCase:  int        = os.path.join(self.tmpdirname     ,    VOCAB_FILES_NAMES['merges_file']   )

      with open(self.vocab_file     ,    'w'     ,    encoding='utf-8'   ) as fp:
       fp.write(json.dumps(UpperCAmelCase   ) + '\n'   )

      with open(self.merges_file     ,    'w'   ) as fp:
       fp.write('\n'.join(UpperCAmelCase   )   )


     def     UpperCAmelCase    (				self     :						Union[str, Any]   )				->      Optional[int]:
      __lowerCAmelCase:  Any        = list(self.get_tokenizer().get_vocab().keys()   )

      self.assertEqual(vocab_keys[0]     ,    '<s>'   )
      self.assertEqual(vocab_keys[1]     ,    '<pad>'   )
      self.assertEqual(vocab_keys[-1]     ,    'vocab'   )
      self.assertEqual(len(UpperCAmelCase   )     ,    1_4   )


     def     UpperCAmelCase    (				self     :						Tuple   )				->      Optional[Any]:
      self.assertEqual(self.get_tokenizer().vocab_size     ,    1_4   )


     def     UpperCAmelCase    (				self     :						int   )				->      Union[str, Any]:
      __lowerCAmelCase:  Union[str, Any]        = SpeechaTextaTokenizer.from_pretrained(self.tmpdirname   )

      # make sure @@ is correctly concatenated
      __lowerCAmelCase:  List[str]        = [4, 6, 8, 7, 1_0]  # ["here@@", "couple", "words", "of@@", "the"]
      __lowerCAmelCase:  Dict        = tokenizer.decode(UpperCAmelCase   )

      self.assertTrue(output_string == 'herecouple words ofthe'   )


     def     UpperCAmelCase    (				self     :						List[str]   )				->      Optional[int]:
      __lowerCAmelCase:  Optional[Any]        = SpeechaTextaTokenizer.from_pretrained(self.tmpdirname   )

      with tempfile.TemporaryDirectory() as tmp_dirname:
       tokenizer.save_pretrained(UpperCAmelCase   )
       os.remove(os.path.join(UpperCAmelCase     ,    'merges.txt'   )   )

       # load tokenizer without merges file should not throw an error
       __lowerCAmelCase:  Optional[int]        = SpeechaTextaTokenizer.from_pretrained(UpperCAmelCase   )

      with tempfile.TemporaryDirectory() as tmp_dirname:
       # save tokenizer and load again
       tokenizer.save_pretrained(UpperCAmelCase   )
       __lowerCAmelCase:  Optional[int]        = SpeechaTextaTokenizer.from_pretrained(UpperCAmelCase   )

      self.assertIsNotNone(UpperCAmelCase   )


     def     UpperCAmelCase    (				self     :						Optional[Any]   )				->      str:
      if not self.test_slow_tokenizer:
       return

      __lowerCAmelCase:  str        = inspect.signature(self.tokenizer_class.__init__   )
      __lowerCAmelCase:  int        = self.get_tokenizer()

      for parameter_name, parameter in signature.parameters.items():
       if parameter.default != inspect.Parameter.empty and parameter_name != "merges_file":
        self.assertIn(UpperCAmelCase     ,    tokenizer.init_kwargs   )








def _a					(			SCREAMING_SNAKE_CASE						:     int = 10_00						)       ->       int:

 """simple docstring"""






 __lowerCAmelCase:  Tuple        = [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)
 __lowerCAmelCase:  List[Any]        = [0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

 __lowerCAmelCase:  Dict        = 0

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

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

   if 0 < i % 1_00 < 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 % 1_00]
   else:
    # add number of letters for twenty, twenty one, ..., ninety
    # nine
    count += ones_counts[i % 10]
    count += tens_counts[(i % 1_00 - i % 10) // 10]
  else:
   count += ones_counts[i // 10_00] + 8
 return count


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





