
"""simple docstring"""





from __future__ import annotations

from queue import Queue







def       __a	(						__lowerCamelCase,						__lowerCamelCase    ):
   a ^= b
   b ^= a
   a ^= b
   return a, b







def       __a	(						__lowerCamelCase,						__lowerCamelCase    ):
   UpperCAmelCase_   :   Tuple     	=       1
   while (1 << j) < max_node:
      for i in range(1,						max_node + 1    ):
         UpperCAmelCase_   :   int     	=       parent[j - 1][parent[j - 1][i]]
      j += 1
   return parent







def       __a	(						__lowerCamelCase,						__lowerCamelCase,						__lowerCamelCase,						__lowerCamelCase    ):
   # u must be deeper in the tree than v
   if level[u] < level[v]:
      UpperCAmelCase_	,  UpperCAmelCase_   :   Dict     	=       swap(__lowerCamelCase,						__lowerCamelCase    )
   # making depth of u same as depth of v
   for i in range(18,						-1,						-1    ):
      if level[u] - (1 << i) >= level[v]:
         UpperCAmelCase_   :   Optional[int]     	=       parent[i][u]
    # at the same depth if u==v that mean lca is found
   if u == v:
      return u
   # moving both nodes upwards till lca in found
   for i in range(18,						-1,						-1    ):
      if parent[i][u] not in [0, parent[i][v]]:
         UpperCAmelCase_	,  UpperCAmelCase_   :   List[Any]     	=       parent[i][u], parent[i][v]
    # returning longest common ancestor of u,v
   return parent[0][u]







def       __a	(						__lowerCamelCase,						__lowerCamelCase,						__lowerCamelCase,						__lowerCamelCase,						__lowerCamelCase = 1,						):
   UpperCAmelCase_   :   Any     	=       0
   UpperCAmelCase_   :   Queue[int]     	=       Queue(maxsize=__lowerCamelCase    )
   q.put(__lowerCamelCase    )
   while q.qsize() != 0:
      UpperCAmelCase_   :   List[str]     	=       q.get()
      for v in graph[u]:
         if level[v] == -1:
            UpperCAmelCase_   :   Dict     	=       level[u] + 1
            q.put(__lowerCamelCase    )
            UpperCAmelCase_   :   Union[str, Any]     	=       u
   return level, parent







def       __a	(						):
   UpperCAmelCase_   :   int     	=       13
   # initializing with 0
   UpperCAmelCase_   :   int     	=       [[0 for _ in range(max_node + 10    )] for _ in range(20    )]
   # initializing with -1 which means every node is unvisited
   UpperCAmelCase_   :   str     	=       [-1 for _ in range(max_node + 10    )]
   UpperCAmelCase_   :   dict[int, list[int]]     	=       {
       1: [2, 3, 4],
       2: [5],
       3: [6, 7],
       4: [8],
       5: [9, 10],
       6: [11],
       7: [],
       8: [12, 13],
       9: [],
       10: [],
       11: [],
       12: [],
       13: [],
   }
   UpperCAmelCase_	,  UpperCAmelCase_   :   int     	=       breadth_first_search(__lowerCamelCase,						__lowerCamelCase,						__lowerCamelCase,						__lowerCamelCase,						1    )
   UpperCAmelCase_   :   List[Any]     	=       create_sparse(__lowerCamelCase,						__lowerCamelCase    )
   print("LCA of node 1 and 3 is: ",						lowest_common_ancestor(1,						3,						__lowerCamelCase,						__lowerCamelCase    )    )
   print("LCA of node 5 and 6 is: ",						lowest_common_ancestor(5,						6,						__lowerCamelCase,						__lowerCamelCase    )    )
   print("LCA of node 7 and 11 is: ",						lowest_common_ancestor(7,						11,						__lowerCamelCase,						__lowerCamelCase    )    )
   print("LCA of node 6 and 7 is: ",						lowest_common_ancestor(6,						7,						__lowerCamelCase,						__lowerCamelCase    )    )
   print("LCA of node 4 and 12 is: ",						lowest_common_ancestor(4,						12,						__lowerCamelCase,						__lowerCamelCase    )    )
   print("LCA of node 8 and 8 is: ",						lowest_common_ancestor(8,						8,						__lowerCamelCase,						__lowerCamelCase    )    )


if __name__ == "__main__":
    main()





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





