





import copy
import inspect

from transformers.testing_utils import require_torch, torch_device
from transformers.utils.backbone_utils import BackboneType





@require_torch
class UpperCAmelCase_							:
  __lowerCAmelCase      :	Union[str, Any]  	=      ()
  __lowerCAmelCase      :	Tuple  	=      True


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_					      =  self.config_class

       # test default config
       A_					      =  config_class()
       self.assertIsNotNone(__snake_case   )
       A_					      =  ['''stem'''] + [f'stage{idx}' for idx in range(1   ,len(config.depths   ) + 1   )]
       self.assertEqual(config.stage_names   ,__snake_case   )
       self.assertTrue(set(config.out_features   ).issubset(set(config.stage_names   )   )   )

       # Test out_features and out_indices are correctly set
       # out_features and out_indices both None
       A_					      =  config_class(out_features=__snake_case   ,out_indices=__snake_case   )
       self.assertEqual(config.out_features   ,[config.stage_names[-1]]   )
       self.assertEqual(config.out_indices   ,[len(config.stage_names   ) - 1]   )

       # out_features and out_indices both set
       A_					      =  config_class(out_features=['''stem''', '''stage1''']   ,out_indices=[0, 1]   )
       self.assertEqual(config.out_features   ,['''stem''', '''stage1''']   )
       self.assertEqual(config.out_indices   ,[0, 1]   )

       # Only out_features set
       A_					      =  config_class(out_features=['''stage1''', '''stage3''']   )
       self.assertEqual(config.out_features   ,['''stage1''', '''stage3''']   )
       self.assertEqual(config.out_indices   ,[1, 3]   )

       # Only out_indices set
       A_					      =  config_class(out_indices=[0, 2]   )
       self.assertEqual(config.out_features   ,[config.stage_names[0], config.stage_names[2]]   )
       self.assertEqual(config.out_indices   ,[0, 2]   )

       # Error raised when out_indices do not correspond to out_features
       with self.assertRaises(__snake_case   ):
            A_					      =  config_class(out_features=['''stage1''', '''stage2''']   ,out_indices=[0, 2]   )


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_      ,						A_					      =  self.model_tester.prepare_config_and_inputs_for_common()

       for model_class in self.all_model_classes:
            A_					      =  model_class(__snake_case   )
            A_					      =  inspect.signature(model.forward   )
            # signature.parameters is an OrderedDict => so arg_names order is deterministic
            A_					      =  [*signature.parameters.keys()]
            A_					      =  ['''pixel_values''']
            self.assertListEqual(arg_names[:1]   ,__snake_case   )


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_      ,						A_					      =  self.model_tester.prepare_config_and_inputs_for_common()

       for model_class in self.all_model_classes:
            A_					      =  model_class(__snake_case   )
            self.assertEqual(len(model.channels   )   ,len(config.out_features   )   )
            A_					      =  model.num_features
            A_					      =  [config.stage_names.index(__snake_case   ) for feat in config.out_features]
            A_					      =  [num_features[idx] for idx in out_indices]
            self.assertListEqual(model.channels   ,__snake_case   )

            A_					      =  copy.deepcopy(__snake_case   )
            A_					      =  None
            A_					      =  model_class(__snake_case   )
            self.assertEqual(len(model.channels   )   ,1   )
            self.assertListEqual(model.channels   ,[num_features[-1]]   )

            A_					      =  copy.deepcopy(__snake_case   )
            A_					      =  None
            A_					      =  model_class(__snake_case   )
            self.assertEqual(len(model.channels   )   ,1   )
            self.assertListEqual(model.channels   ,[num_features[-1]]   )


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_      ,						A_					      =  self.model_tester.prepare_config_and_inputs_for_common()

       for model_class in self.all_model_classes:
            A_					      =  model_class(__snake_case   )
            model.to(__snake_case   )
            model.eval()
            A_					      =  model(**__snake_case   )

            self.assertEqual(len(result.feature_maps   )   ,len(config.out_features   )   )
            self.assertEqual(len(model.channels   )   ,len(config.out_features   )   )
            self.assertEqual(len(result.feature_maps   )   ,len(config.out_indices   )   )
            self.assertEqual(len(model.channels   )   ,len(config.out_indices   )   )

            # Check output of last stage is taken if out_features=None, out_indices=None
            A_					      =  copy.deepcopy(__snake_case   )
            A_					      =  None
            A_					      =  model_class(__snake_case   )
            model.to(__snake_case   )
            model.eval()
            A_					      =  model(**__snake_case   )

            self.assertEqual(len(result.feature_maps   )   ,1   )
            self.assertEqual(len(model.channels   )   ,1   )

            A_					      =  copy.deepcopy(__snake_case   )
            A_					      =  None
            A_					      =  model_class(__snake_case   )
            model.to(__snake_case   )
            model.eval()
            A_					      =  model(**__snake_case   )

            self.assertEqual(len(result.feature_maps   )   ,1   )
            self.assertEqual(len(model.channels   )   ,1   )

            # Check backbone can be initialized with fresh weights
            A_					      =  copy.deepcopy(__snake_case   )
            A_					      =  False
            A_					      =  model_class(__snake_case   )
            model.to(__snake_case   )
            model.eval()
            A_					      =  model(**__snake_case   )


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_      ,						A_					      =  self.model_tester.prepare_config_and_inputs_for_common()

       for backbone_class in self.all_model_classes:
            A_					      =  backbone_class(__snake_case   )

            self.assertTrue(hasattr(__snake_case   ,'''backbone_type'''   )   )
            self.assertTrue(hasattr(__snake_case   ,'''stage_names'''   )   )
            self.assertTrue(hasattr(__snake_case   ,'''num_features'''   )   )
            self.assertTrue(hasattr(__snake_case   ,'''out_indices'''   )   )
            self.assertTrue(hasattr(__snake_case   ,'''out_features'''   )   )
            self.assertTrue(hasattr(__snake_case   ,'''out_feature_channels'''   )   )
            self.assertTrue(hasattr(__snake_case   ,'''channels'''   )   )

            self.assertIsInstance(backbone.backbone_type   ,__snake_case   )
            # Verify num_features has been initialized in the backbone init
            self.assertIsNotNone(backbone.num_features   )
            self.assertTrue(len(backbone.channels   ) == len(backbone.out_indices   )   )
            self.assertTrue(len(backbone.stage_names   ) == len(backbone.num_features   )   )
            self.assertTrue(len(backbone.channels   ) <= len(backbone.num_features   )   )
            self.assertTrue(len(backbone.out_feature_channels   ) == len(backbone.stage_names   )   )




  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_      ,						A_					      =  self.model_tester.prepare_config_and_inputs_for_common()
       A_					      =  inputs_dict['''pixel_values'''].shape[0]

       for backbone_class in self.all_model_classes:
            A_					      =  backbone_class(__snake_case   )
            backbone.to(__snake_case   )
            backbone.eval()

            A_					      =  backbone(**__snake_case   )

            # Test default outputs and verify feature maps
            self.assertIsInstance(outputs.feature_maps   ,__snake_case   )
            self.assertTrue(len(outputs.feature_maps   ) == len(backbone.channels   )   )
            for feature_map, n_channels in zip(outputs.feature_maps   ,backbone.channels   ):
                 self.assertTrue(feature_map.shape[:2]   ,(batch_size, n_channels)   )
            self.assertIsNone(outputs.hidden_states   )
            self.assertIsNone(outputs.attentions   )

            # Test output_hidden_states=True
            A_					      =  backbone(**__snake_case   ,output_hidden_states=__snake_case   )
            self.assertIsNotNone(outputs.hidden_states   )
            self.assertTrue(len(outputs.hidden_states   )   ,len(backbone.stage_names   )   )
            for hidden_state, n_channels in zip(outputs.hidden_states   ,backbone.channels   ):
                 self.assertTrue(hidden_state.shape[:2]   ,(batch_size, n_channels)   )

            # Test output_attentions=True
            if self.has_attentions:
                 A_					      =  backbone(**__snake_case   ,output_attentions=__snake_case   )
                 self.assertIsNotNone(outputs.attentions   )










def     UpperCAmelCase_						(						_UpperCAmelCase       :int = 1000							)  ->							int:
     '''simple docstring'''


     A_					      =					[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)
     A_					      =					[0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

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



