





import io
import json
import unittest

from parameterized import parameterized

from transformers import FSMTForConditionalGeneration, FSMTTokenizer
from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device
from utils import calculate_bleu


_lowerCamelCase			       =      get_tests_dir() + '/test_data/fsmt/fsmt_val_data.json'
with io.open(filename, 'r', encoding='utf-8') as f:
       _lowerCamelCase			       =      json.load(f)







@require_torch
class 			__A       (      unittest.TestCase  ):




      """simple docstring"""







      def 				__snake_case			(		self      ,							a__):



             """simple docstring"""





             return FSMTTokenizer.from_pretrained(a__)


      def 				__snake_case			(		self      ,							a__):



             """simple docstring"""





             _lowerCamelCase							:     int	=		FSMTForConditionalGeneration.from_pretrained(a__).to(a__)
             if torch_device == "cuda":
                    model.half()
             return model



      @parameterized.expand(
          [
              ['''en-ru''', 26.0],
              ['''ru-en''', 22.0],
              ['''en-de''', 22.0],
              ['''de-en''', 29.0],
          ])
      @slow
      def 				__snake_case			(		self      ,							a__      ,							a__):



             """simple docstring"""





             _lowerCamelCase							:     List[Any]	=		F"""facebook/wmt19-{pair}"""
             _lowerCamelCase							:     Union[str, Any]	=		self.get_tokenizer(a__)
             _lowerCamelCase							:     str	=		self.get_model(a__)

             _lowerCamelCase							:     Dict	=		bleu_data[pair]['''src''']
             _lowerCamelCase							:     Optional[int]	=		bleu_data[pair]['''tgt''']

             _lowerCamelCase							:     List[Any]	=		tokenizer(a__      ,							return_tensors='''pt'''      ,							truncation=a__      ,							padding='''longest''').to(a__)
             _lowerCamelCase							:     Optional[Any]	=		model.generate(
                 input_ids=batch.input_ids      ,							num_beams=8      ,							)
             _lowerCamelCase							:     Tuple	=		tokenizer.batch_decode(
                 a__      ,							skip_special_tokens=a__      ,							clean_up_tokenization_spaces=a__)
             _lowerCamelCase							:     List[Any]	=		calculate_bleu(a__      ,							a__)
             print(a__)
             self.assertGreaterEqual(scores['''bleu''']      ,							a__)








def    __UpperCAmelCase(      lowercase_ = 10_00      ):
       _lowerCamelCase							:     Optional[int]	=		2**power
       _lowerCamelCase							:     Optional[int]	=		0
       while n:
              _lowerCamelCase,  _lowerCamelCase							:     Optional[Any]	=		r + n % 10, n // 10
       return r


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

