

from __future__ import annotations

import random
import string


class 					A		:







    """simple docstring"""





    def __init__( self					:			Optional[Any],lowercase_					:			Dict = None						)->       Optional[int]:





        '''simple docstring'''







        A__        =  passcode or self.__passcode_creator()
        A__        =  self.__make_key_list()
        A__        =  self.__make_shift_key()


    def __str__( self					:			Tuple						)->       str:





        '''simple docstring'''







        return "".join(self.__passcode						)


    def 		snake_case__	( self					:			List[str],lowercase_					:			Optional[Any]						)->       Tuple:





        '''simple docstring'''







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


    def 		snake_case__	( self					:			Optional[Any]						)->       str:





        '''simple docstring'''







        A__        =  string.ascii_letters + string.digits
        A__        =  [random.choice(_UpperCAmelCase						) for _ in range(random.randint(1_0,2_0						)						)]
        return password


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





        '''simple docstring'''







        A__        =  (
            string.ascii_letters + string.digits + string.punctuation + ''' \t\n'''
        )

        A__        =  []

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

        # 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					:			Dict						)->       Optional[int]:





        '''simple docstring'''







        A__        =  sum(self.__neg_pos([ord(_UpperCAmelCase						) for x in self.__passcode]						)						)
        return num if num > 0 else len(self.__passcode						)


    def 		snake_case__	( self					:			Optional[int],lowercase_					:			Any						)->       Optional[Any]:





        '''simple docstring'''







        A__        =  ''''''

        # decoding shift like Caesar cipher algorithm implementing negative shift or
        # reverse shift or left shift
        for i in encoded_message:
            A__        =  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					:			str,lowercase_					:			Any						)->       List[str]:





        '''simple docstring'''







        A__        =  ''''''

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

        return encoded_message




def 		_snake_case(       SCREAMING_SNAKE_CASE__     :      str = "Hello, this is a modified Caesar cipher" )				-> str:





    '''simple docstring'''






    A__        =  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())))
