

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer, Trainer, TrainingArguments

import datasets


_a									=  '''\
@article{eddine2021frugalscore,
  title={FrugalScore: Learning Cheaper, Lighter and Faster Evaluation Metrics for Automatic Text Generation},
  author={Eddine, Moussa Kamal and Shang, Guokan and Tixier, Antoine J-P and Vazirgiannis, Michalis},
  journal={arXiv preprint arXiv:2110.08559},
  year={2021}
}
'''

_a									=  '''\
FrugalScore is a reference-based metric for NLG models evaluation. It is based on a distillation approach that allows to learn a fixed, low cost version of any expensive NLG metric, while retaining most of its original performance.
'''


_a									=  '''
Calculates how good are predictions given some references, using certain scores.
Args:
    predictions (list of str): list of predictions to score. Each predictions
        should be a string.
    references (list of str): list of reference for each prediction. Each
        reference should be a string.
    batch_size (int): the batch size for predictions.
    max_length (int): maximum sequence length.
    device (str): either gpu or cpu
Returns:
    scores (list of int): list of scores.
Examples:
    >>> frugalscore = datasets.load_metric("frugalscore")
    >>> results = frugalscore.compute(predictions=[\'hello there\', \'huggingface\'], references=[\'hello world\', \'hugging face\'])
    >>> print([round(s, 3) for s in results["scores"]])
    [0.631, 0.645]
'''






@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION				,      _KWARGS_DESCRIPTION   )
class 				A_					(						datasets.Metric   ):


     def     UpperCAmelCase    (				self     :						Dict   )				->      Optional[Any]:
      return datasets.MetricInfo(
          description=_DESCRIPTION     ,    citation=_CITATION     ,    inputs_description=_KWARGS_DESCRIPTION     ,    features=datasets.Features(
              {
                  'predictions': datasets.Value('string'   ),
                  'references': datasets.Value('string'   ),
              }   )     ,    homepage='https://github.com/moussaKam/FrugalScore'     ,    )


     def     UpperCAmelCase    (				self     :						Tuple     ,    UpperCAmelCase     :						str   )				->      List[str]:
      if self.config_name == "default":
       __lowerCAmelCase:  List[str]        = 'moussaKam/frugalscore_tiny_bert-base_bert-score'
      else:
       __lowerCAmelCase:  Union[str, Any]        = self.config_name
      __lowerCAmelCase:  Dict        = AutoModelForSequenceClassification.from_pretrained(UpperCAmelCase   )
      __lowerCAmelCase:  Any        = AutoTokenizer.from_pretrained(UpperCAmelCase   )


     def     UpperCAmelCase    (				self     :						List[str]     ,    UpperCAmelCase     :						List[str]     ,    UpperCAmelCase     :						Optional[Any]     ,    UpperCAmelCase     :						Optional[int]=3_2     ,    UpperCAmelCase     :						Dict=1_2_8     ,    UpperCAmelCase     :						Any=None     ,    )				->      Dict:
      assert len(UpperCAmelCase   ) == len(
          UpperCAmelCase   ), "predictions and references should have the same number of sentences."
      if device is not None:
       assert device in ["gpu", "cpu"], "device should be either gpu or cpu."
      else:
       __lowerCAmelCase:  int        = 'gpu' if torch.cuda.is_available() else 'cpu'
      __lowerCAmelCase:  Dict        = TrainingArguments(
          'trainer'     ,    fpaa=(device == 'gpu')     ,    per_device_eval_batch_size=UpperCAmelCase     ,    report_to='all'     ,    no_cuda=(device == 'cpu')     ,    log_level='warning'     ,    )
      __lowerCAmelCase:  List[str]        = {'sentence1': predictions, 'sentence2': references}
      __lowerCAmelCase:  int        = datasets.Dataset.from_dict(UpperCAmelCase   )

      def tokenize_function(UpperCAmelCase     :						List[str]   ):
       return self.tokenizer(
           data['sentence1']     ,    data['sentence2']     ,    max_length=UpperCAmelCase     ,    truncation=UpperCAmelCase     ,    padding=UpperCAmelCase   )

      __lowerCAmelCase:  int        = raw_datasets.map(UpperCAmelCase     ,    batched=UpperCAmelCase   )
      tokenized_datasets.remove_columns(['sentence1', 'sentence2']   )
      __lowerCAmelCase:  List[str]        = Trainer(self.model     ,    UpperCAmelCase     ,    tokenizer=self.tokenizer   )
      __lowerCAmelCase:  Any        = trainer.predict(UpperCAmelCase   )
      return {"scores": list(predictions.predictions.squeeze(-1   )   )}








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





