


'''simple docstring'''


import numpy as np
import PIL
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as TF
from PIL import Image


def       snake_case_       (  SCREAMING_SNAKE_CASE__							,				SCREAMING_SNAKE_CASE__=256					):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE			:	Any							=				min(img.size					)

				if s < target_image_size:
								raise ValueError(f"""min dim for image {s} < {target_image_size}"""					)

				_SCREAMING_SNAKE_CASE			:	List[Any]							=				target_image_size / s
				_SCREAMING_SNAKE_CASE			:	Any							=				(round(r * img.size[1]					), round(r * img.size[0]					))
				_SCREAMING_SNAKE_CASE			:	Any							=				TF.resize(SCREAMING_SNAKE_CASE__							,				SCREAMING_SNAKE_CASE__							,				interpolation=PIL.Image.LANCZOS					)
				_SCREAMING_SNAKE_CASE			:	int							=				TF.center_crop(SCREAMING_SNAKE_CASE__							,				output_size=2 * [target_image_size]					)
				_SCREAMING_SNAKE_CASE			:	List[str]							=				torch.unsqueeze(T.ToTensor()(SCREAMING_SNAKE_CASE__					)							,				0					)
				return img


def       snake_case_       (  SCREAMING_SNAKE_CASE__					):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE			:	Optional[Any]							=				2.0 * x - 1.0
				return x


def       snake_case_       (  SCREAMING_SNAKE_CASE__							,				SCREAMING_SNAKE_CASE__=True							,				SCREAMING_SNAKE_CASE__="RGB"					):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE			:	Tuple							=				x.detach().cpu()
				if process:
								_SCREAMING_SNAKE_CASE			:	Dict							=				post_process_tensor(SCREAMING_SNAKE_CASE__					)
				_SCREAMING_SNAKE_CASE			:	Any							=				x.numpy()
				if process:
								_SCREAMING_SNAKE_CASE			:	Optional[Any]							=				(255 * x).astype(np.uinta					)
				_SCREAMING_SNAKE_CASE			:	Optional[int]							=				Image.fromarray(SCREAMING_SNAKE_CASE__					)
				if not x.mode == mode:
								_SCREAMING_SNAKE_CASE			:	List[Any]							=				x.convert(SCREAMING_SNAKE_CASE__					)
				return x


def       snake_case_       (  SCREAMING_SNAKE_CASE__					):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE			:	Optional[Any]							=				torch.clamp(SCREAMING_SNAKE_CASE__							,				-1.0							,				1.0					)
				_SCREAMING_SNAKE_CASE			:	Union[str, Any]							=				(x + 1.0) / 2.0
				_SCREAMING_SNAKE_CASE			:	List[Any]							=				x.permute(1							,				2							,				0					)
				return x







def       snake_case_       (  SCREAMING_SNAKE_CASE__					):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE			:	int							=				post_process_tensor(x.squeeze()					)
				return x.permute(2							,				0							,				1					).unsqueeze(0					)








'''simple docstring'''


def       snake_case_       (  SCREAMING_SNAKE_CASE__ = 1000					):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE			:	Union[str, 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)
				_SCREAMING_SNAKE_CASE			:	str							=				[0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

				_SCREAMING_SNAKE_CASE			:	Any							=				0

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


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




