





'''simple docstring'''






from __future__ import annotations

import random
import string


class 	_lowercase    :


   def __init__(			self     , _UpperCAmelCase = None       ):
       A							:							Dict				=    passcode or self.__passcode_creator()
       A							:							Optional[Any]				=    self.__make_key_list()
       A							:							int				=    self.__make_shift_key()


   def __str__(			self       ):
       return "".join(self.__passcode       )


   def        snake_case					(			self     , _UpperCAmelCase       ):
       for i in range(1     , len(_UpperCAmelCase       )     , 2       ):
           iterlist[i] *= -1
       return iterlist


   def        snake_case					(			self       ):
       A							:							List[str]				=    string.ascii_letters + string.digits
       A							:							List[Any]				=    [random.choice(_UpperCAmelCase       ) for _ in range(random.randint(10     , 20       )       )]
       return password


   def        snake_case					(			self       ):
       A							:							List[Any]				=    (
           string.ascii_letters + string.digits + string.punctuation + ''' \t\n'''
       )

       A							:							List[Any]				=    []

       # creates points known as breakpoints to break the key_list_options at those
       # points and pivot each substring
       A							:							List[str]				=    sorted(set(self.__passcode       )       )
       A							:							list[str]				=    []

       # algorithm for creating a new shuffled list, keys_l, out of key_list_options
       for i in key_list_options:
           temp_list.extend(_UpperCAmelCase       )

           # checking breakpoints at which to pivot temporary sublist and add it into
           # keys_l
           if i in breakpoints or i == key_list_options[-1]:
               keys_l.extend(temp_list[::-1]       )
               temp_list.clear()

        # returning a shuffled keys_l to prevent brute force guessing of shift key
       return keys_l


   def        snake_case					(			self       ):
       A							:							Union[str, Any]				=    sum(self.__neg_pos([ord(_UpperCAmelCase       ) for x in self.__passcode]       )       )
       return num if num > 0 else len(self.__passcode       )


   def        snake_case					(			self     , _UpperCAmelCase       ):
       A							:							List[Any]				=    ''''''

       # decoding shift like Caesar cipher algorithm implementing negative shift or
       # reverse shift or left shift
       for i in encoded_message:
           A							:							Dict				=    self.__key_list.index(_UpperCAmelCase       )
           decoded_message += self.__key_list[
               (position - self.__shift_key) % -len(self.__key_list       )
           ]

       return decoded_message


   def        snake_case					(			self     , _UpperCAmelCase       ):
       A							:							str				=    ''''''

       # encoding shift like Caesar cipher algorithm implementing positive shift or
       # forward shift or right shift
       for i in plaintext:
           A							:							Any				=    self.__key_list.index(_UpperCAmelCase       )
           encoded_message += self.__key_list[
               (position + self.__shift_key) % len(self.__key_list       )
           ]

       return encoded_message







def 				_lowerCamelCase(	UpperCamelCase__     :			str = "Hello, this is a modified Caesar cipher"		)		->	str:
    A							:							List[Any]				=    ShuffledShiftCipher()
    return cipa.decrypt(cipa.encrypt(UpperCamelCase__		)		)


if __name__ == "__main__":
     import doctest

     doctest.testmod()







'''simple docstring'''






def 				_lowerCamelCase(	UpperCamelCase__     :			int = 1_000		)		->	int:
    A							:							Optional[Any]				=    [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)
    A							:							Tuple				=    [0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

    A							:							str				=    0

    for i in range(1     ,							n + 1		):
        if i < 1_000:
            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 // 1_000] + 8
    return count


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