


"""simple docstring"""
from typing import List, Optional, Tuple, Union

import torch

from ...models import UNetaDModel
from ...schedulers import PNDMScheduler
from ...utils import randn_tensor
from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput





class   __A  (snake_case__):





							'''simple docstring'''

							__lowercase:		List[Any]				   =     42
							__lowercase:		int				   =     42



							def __init__(					self				:   List[str]		,							UpperCAmelCase_				:   UNetaDModel		,							UpperCAmelCase_				:   PNDMScheduler							)       ->int:



														"""simple docstring"""



														super().__init__()

														snake_case_     							=		PNDMScheduler.from_config(scheduler.config							)

														self.register_modules(unet=UpperCamelCase_		,							scheduler=UpperCamelCase_							)



							@torch.no_grad()
							def __call__(					self				:   List[Any]		,							UpperCAmelCase_				:   int = 1		,							UpperCAmelCase_				:   int = 50		,							UpperCAmelCase_				:   Optional[Union[torch.Generator, List[torch.Generator]]] = None		,							UpperCAmelCase_				:   Optional[str] = "pil"		,							UpperCAmelCase_				:   bool = True		,							**UpperCAmelCase_				:   Any		,							)       ->Union[ImagePipelineOutput, Tuple]:



														"""simple docstring"""



														snake_case_     							=		randn_tensor(
														    (batch_size, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size)		,							generator=UpperCamelCase_		,							device=self.device		,							)

														self.scheduler.set_timesteps(UpperCamelCase_							)
														for t in self.progress_bar(self.scheduler.timesteps							):
																					snake_case_     							=		self.unet(UpperCamelCase_		,							UpperCamelCase_							).sample

																					snake_case_     							=		self.scheduler.step(UpperCamelCase_		,							UpperCamelCase_		,							UpperCamelCase_							).prev_sample

														snake_case_     							=		(image / 2 + 0.5).clamp(0		,							1							)
														snake_case_     							=		image.cpu().permute(0		,							2		,							3		,							1							).numpy()
														if output_type == "pil":
																					snake_case_     							=		self.numpy_to_pil(UpperCamelCase_							)

														if not return_dict:
																					return (image,)

														return ImagePipelineOutput(images=UpperCamelCase_							)








'''simple docstring'''

def     __UpperCamelCase					(				_lowercase = 1000       )			->      int:
	_lowercase       :							Optional[int]  	=		[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)
	_lowercase       :							List[Any]  	=		[0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

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