




'''simple docstring'''







def 					lowerCamelCase__							(			__lowercase = 1_000							):
     snake_case :			List[str]					   = [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)
     snake_case :			List[Any]					   = [0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

     snake_case :			Union[str, Any]					   = 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())))









'''simple docstring'''







from dataclasses import dataclass

lowercase			:      Tuple			=					"""0.1"""
lowercase			:      Optional[Any]			=					"""Lucia Harcekova"""







@dataclass
class 				_a   :





     '''simple docstring'''



     lowerCAmelCase_     :    int
     lowerCAmelCase_     :    int
     lowerCAmelCase_     :    str







     def __repr__(							self       )			->							str:
          return F'''({self.offset}, {self.length}, {self.indicator})'''







class 				_a   :





     '''simple docstring'''



     def __init__(							self       ,__a = 13       ,__a = 6       )			->							None:
          snake_case :			Dict					   = window_size
          snake_case :			Any					   = lookahead_buffer_size
          snake_case :			str					   = self.window_size - self.lookahead_buffer_size







     def  snake_case_			(							self       ,__a       )			->							list[Token]:
          snake_case :			Tuple					   = []
          snake_case :			Optional[int]					   = """"""

          # while there are still characters in text to compress
          while text:
               # find the next encoding phrase
               # - triplet with offset, length, indicator (the next encoding character)
               snake_case :			str					   = self._find_encoding_token(__a       ,__a       )

               # update the search buffer:
               # - add new characters from text into it
               # - check if size exceed the max search buffer size, if so, drop the
               #   oldest elements
               search_buffer += text[: token.length + 1]
               if len(__a       ) > self.search_buffer_size:
                    snake_case :			List[Any]					   = search_buffer[-self.search_buffer_size :]

               # update the text
               snake_case :			str					   = text[token.length + 1 :]

               # append the token to output
               output.append(__a       )

          return output







     def  snake_case_			(							self       ,__a       )			->							str:
          snake_case :			Union[str, Any]					   = """"""

          for token in tokens:
               for _ in range(token.length       ):
                    output += output[-token.offset]
               output += token.indicator

          return output







     def  snake_case_			(							self       ,__a       ,__a       )			->							Token:

          if not text:
               raise ValueError("""We need some text to work with."""       )

          # Initialise result parameters to default values
          snake_case   ,		snake_case :			int					   = 0, 0

          if not search_buffer:
               return Token(__a       ,__a       ,text[length]       )

          for i, character in enumerate(__a       ):
               snake_case :			Tuple					   = len(__a       ) - i
               if character == text[0]:
                    snake_case :			List[Any]					   = self._match_length_from_index(__a       ,__a       ,0       ,__a       )
                    # if the found length is bigger than the current or if it's equal,
                    # which means it's offset is smaller: update offset and length
                    if found_length >= length:
                         snake_case   ,		snake_case :			Optional[Any]					   = found_offset, found_length

          return Token(__a       ,__a       ,text[length]       )







     def  snake_case_			(							self       ,__a       ,__a       ,__a       ,__a       )			->							int:
          if not text or text[text_index] != window[window_index]:
               return 0
          return 1 + self._match_length_from_index(
              __a       ,window + text[text_index]       ,text_index + 1       ,window_index + 1       )


if __name__ == "__main__":
      from doctest import testmod

      testmod()
      # Initialize compressor class
      lowercase			:      int			=					LZaaCompressor(window_size=13, lookahead_buffer_size=6)

      # Example
      lowercase			:      int			=					"""cabracadabrarrarrad"""
      lowercase			:      str			=					lzaa_compressor.compress(TEXT)
      print(lzaa_compressor.compress("""ababcbababaa"""))
      lowercase			:      List[Any]			=					lzaa_compressor.decompress(compressed_text)
      assert decompressed_text == TEXT, "The LZ77 algorithm returned the invalid result."



