





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


UpperCAmelCase_							=				get_tests_dir() + """/test_data/fsmt/fsmt_val_data.json"""
with io.open(filename, """r""", encoding="""utf-8""") as f:
							UpperCAmelCase_							=				json.load(f)
@require_torch
class     UpperCamelCase__					(     unittest.TestCase				):






		'''simple docstring'''






		def 						snake_case__				(							self,   snake_case__  )       -> List[Any]:






									"""simple docstring"""
									return FSMTTokenizer.from_pretrained(snake_case__  )






		def 						snake_case__				(							self,   snake_case__  )       -> str:






									"""simple docstring"""
									lowercase_	:   Any  				=     FSMTForConditionalGeneration.from_pretrained(snake_case__  ).to(snake_case__  )
									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,   snake_case__,   snake_case__  )       -> Tuple:






									"""simple docstring"""
									# note: this test is not testing the best performance since it only evals a small batch
									# but it should be enough to detect a regression in the output quality
									lowercase_	:   Optional[Any]  				=     f"""facebook/wmt19-{pair}"""
									lowercase_	:   List[Any]  				=     self.get_tokenizer(snake_case__  )
									lowercase_	:   List[Any]  				=     self.get_model(snake_case__  )

									lowercase_	:   int  				=     bleu_data[pair]["""src"""]
									lowercase_	:   Optional[Any]  				=     bleu_data[pair]["""tgt"""]

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






def  __magic_name__  (				lowercase = 1000				)				-> int:

							"""simple docstring"""



							lowercase_				,		lowercase_	:   Optional[Any]  				=     1, 1
							lowercase_	:   Tuple  				=     2
							while True:
														lowercase_	:   Dict  				=     0
														lowercase_	:   List[Any]  				=     fa + fa
														lowercase_				,		lowercase_	:   List[str]  				=     fa, f
														index += 1
														for _ in str(lowercase				):
																					i += 1
														if i == n:
																					break
							return index


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