
"""simple docstring"""
import torch

from diffusers import DDIMScheduler

from .test_schedulers import SchedulerCommonTest






class   _UpperCAmelCase					(       _snake_case):
    __lowercase				:			Union[str, Any]	=       (DDIMScheduler,)
    __lowercase				:			List[str]	=       (("""eta""", 0.0), ("""num_inference_steps""", 5_0))
    def        lowerCamelCase__						(     self    ,     **snake_case_  ):
      _snake_case  :    Tuple            = {
          "num_train_timesteps": 10_00,
          "beta_start": 0.0001,
          "beta_end": 0.02,
          "beta_schedule": "linear",
          "clip_sample": True,
      }

      config.update(**snake_case_  )
      return config
    def        lowerCamelCase__						(     self    ,     **snake_case_  ):
      _snake_case  :    Optional[int]            = self.scheduler_classes[0]
      _snake_case  :    Dict            = self.get_scheduler_config(**snake_case_  )
      _snake_case  :    Optional[int]            = scheduler_class(**snake_case_  )

      _snake_case      ,       _snake_case  :    List[Any]            = 10, 0.0

      _snake_case  :    List[Any]            = self.dummy_model()
      _snake_case  :    Tuple            = self.dummy_sample_deter

      scheduler.set_timesteps(snake_case_  )

      for t in scheduler.timesteps:
        _snake_case  :    Tuple            = model(snake_case_    ,     snake_case_  )
        _snake_case  :    Optional[Any]            = scheduler.step(snake_case_    ,     snake_case_    ,     snake_case_    ,     snake_case_  ).prev_sample

      return sample
    def        lowerCamelCase__						(     self  ):
      for timesteps in [1_00, 5_00, 10_00]:
        self.check_over_configs(num_train_timesteps=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      for steps_offset in [0, 1]:
        self.check_over_configs(steps_offset=snake_case_  )

      _snake_case  :    Optional[int]            = self.scheduler_classes[0]
      _snake_case  :    Optional[Any]            = self.get_scheduler_config(steps_offset=1  )
      _snake_case  :    Tuple            = scheduler_class(**snake_case_  )
      scheduler.set_timesteps(5  )
      assert torch.equal(scheduler.timesteps    ,     torch.LongTensor([8_01, 6_01, 4_01, 2_01, 1]  )  )
    def        lowerCamelCase__						(     self  ):
      for beta_start, beta_end in zip([0.0001, 0.001, 0.01, 0.1]    ,     [0.002, 0.02, 0.2, 2]  ):
        self.check_over_configs(beta_start=snake_case_    ,     beta_end=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      for schedule in ["linear", "squaredcos_cap_v2"]:
        self.check_over_configs(beta_schedule=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      for prediction_type in ["epsilon", "v_prediction"]:
        self.check_over_configs(prediction_type=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      for clip_sample in [True, False]:
        self.check_over_configs(clip_sample=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      for timestep_spacing in ["trailing", "leading"]:
        self.check_over_configs(timestep_spacing=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      for rescale_betas_zero_snr in [True, False]:
        self.check_over_configs(rescale_betas_zero_snr=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      self.check_over_configs(thresholding=snake_case_  )
      for threshold in [0.5, 1.0, 2.0]:
        for prediction_type in ["epsilon", "v_prediction"]:
          self.check_over_configs(
              thresholding=snake_case_    ,     prediction_type=snake_case_    ,     sample_max_value=snake_case_    ,     )
    def        lowerCamelCase__						(     self  ):
      for t in [1, 10, 49]:
        self.check_over_forward(time_step=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      for t, num_inference_steps in zip([1, 10, 50]    ,     [10, 50, 5_00]  ):
        self.check_over_forward(time_step=snake_case_    ,     num_inference_steps=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      for t, eta in zip([1, 10, 49]    ,     [0.0, 0.5, 1.0]  ):
        self.check_over_forward(time_step=snake_case_    ,     eta=snake_case_  )
    def        lowerCamelCase__						(     self  ):
      _snake_case  :    List[Any]            = self.scheduler_classes[0]
      _snake_case  :    Optional[Any]            = self.get_scheduler_config()
      _snake_case  :    Optional[Any]            = scheduler_class(**snake_case_  )

      assert torch.sum(torch.abs(scheduler._get_variance(0    ,     0  ) - 0.0  )  ) < 1E-5
      assert torch.sum(torch.abs(scheduler._get_variance(4_20    ,     4_00  ) - 0.14771  )  ) < 1E-5
      assert torch.sum(torch.abs(scheduler._get_variance(9_80    ,     9_60  ) - 0.32460  )  ) < 1E-5
      assert torch.sum(torch.abs(scheduler._get_variance(0    ,     0  ) - 0.0  )  ) < 1E-5
      assert torch.sum(torch.abs(scheduler._get_variance(4_87    ,     4_86  ) - 0.00979  )  ) < 1E-5
      assert torch.sum(torch.abs(scheduler._get_variance(9_99    ,     9_98  ) - 0.02  )  ) < 1E-5
    def        lowerCamelCase__						(     self  ):
      _snake_case  :    List[Any]            = self.full_loop()

      _snake_case  :    Union[str, Any]            = torch.sum(torch.abs(snake_case_  )  )
      _snake_case  :    Tuple            = torch.mean(torch.abs(snake_case_  )  )

      assert abs(result_sum.item() - 172.0067  ) < 1E-2
      assert abs(result_mean.item() - 0.223967  ) < 1E-3
    def        lowerCamelCase__						(     self  ):
      _snake_case  :    List[Any]            = self.full_loop(prediction_type="v_prediction"  )

      _snake_case  :    Optional[Any]            = torch.sum(torch.abs(snake_case_  )  )
      _snake_case  :    Optional[int]            = torch.mean(torch.abs(snake_case_  )  )

      assert abs(result_sum.item() - 52.5302  ) < 1E-2
      assert abs(result_mean.item() - 0.0684  ) < 1E-3
    def        lowerCamelCase__						(     self  ):
      # We specify different beta, so that the first alpha is 0.99
      _snake_case  :    Tuple            = self.full_loop(set_alpha_to_one=snake_case_    ,     beta_start=0.01  )
      _snake_case  :    str            = torch.sum(torch.abs(snake_case_  )  )
      _snake_case  :    Union[str, Any]            = torch.mean(torch.abs(snake_case_  )  )

      assert abs(result_sum.item() - 149.8295  ) < 1E-2
      assert abs(result_mean.item() - 0.1951  ) < 1E-3


    def        lowerCamelCase__						(     self  ):
      # We specify different beta, so that the first alpha is 0.99
      _snake_case  :    Dict            = self.full_loop(set_alpha_to_one=snake_case_    ,     beta_start=0.01  )
      _snake_case  :    Tuple            = torch.sum(torch.abs(snake_case_  )  )
      _snake_case  :    Dict            = torch.mean(torch.abs(snake_case_  )  )

      assert abs(result_sum.item() - 149.0784  ) < 1E-2
      assert abs(result_mean.item() - 0.1941  ) < 1E-3






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