


"""simple docstring"""






import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch

import numpy as np
from datasets import Dataset

from transformers.models.realm.configuration_realm import RealmConfig
from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAME, RealmRetriever
from transformers.models.realm.tokenization_realm import VOCAB_FILES_NAMES, RealmTokenizer


class     __lowerCamelCase  (					_lowerCAmelCase				):

					'''simple docstring'''


					def 							_UpperCAmelCase      (      self							)       ->							List[str]:
										_a    	=				tempfile.mkdtemp()
										_a    	=				5

										# Realm tok
										_a    	=				[
										    '''[UNK]''',
										    '''[CLS]''',
										    '''[SEP]''',
										    '''[PAD]''',
										    '''[MASK]''',
										    '''test''',
										    '''question''',
										    '''this''',
										    '''is''',
										    '''the''',
										    '''first''',
										    '''second''',
										    '''third''',
										    '''fourth''',
										    '''fifth''',
										    '''record''',
										    '''want''',
										    '''##want''',
										    '''##ed''',
										    '''wa''',
										    '''un''',
										    '''runn''',
										    '''##ing''',
										    ''',''',
										    '''low''',
										    '''lowest''',
										]
										_a    	=				os.path.join(self.tmpdirname    ,				'''realm_tokenizer'''							)
										os.makedirs(_lowerCAmelCase    ,				exist_ok=_lowerCAmelCase							)
										_a    	=				os.path.join(_lowerCAmelCase    ,				VOCAB_FILES_NAMES['''vocab_file''']							)
										with open(self.vocab_file    ,				'''w'''    ,				encoding='''utf-8'''							) as vocab_writer:
															vocab_writer.write(''''''.join([x + '''\n''' for x in vocab_tokens]							)							)

										_a    	=				os.path.join(self.tmpdirname    ,				'''realm_block_records'''							)
										os.makedirs(_lowerCAmelCase    ,				exist_ok=_lowerCAmelCase							)


					def 							_UpperCAmelCase      (      self							)       ->							RealmTokenizer:
										return RealmTokenizer.from_pretrained(os.path.join(self.tmpdirname    ,				'''realm_tokenizer'''							)							)


					def 							_UpperCAmelCase      (      self							)       ->							List[str]:
										shutil.rmtree(self.tmpdirname							)


					def 							_UpperCAmelCase      (      self							)       ->							List[str]:
										_a    	=				RealmConfig(num_block_records=self.num_block_records							)
										return config


					def 							_UpperCAmelCase      (      self							)       ->							Union[str, Any]:
										_a    	=				Dataset.from_dict(
										    {
										        '''id''': ['''0''', '''1'''],
										        '''question''': ['''foo''', '''bar'''],
										        '''answers''': [['''Foo''', '''Bar'''], ['''Bar''']],
										    }							)
										return dataset


					def 							_UpperCAmelCase      (      self							)       ->							str:
										_a    	=				np.array(
										    [
										        B'''This is the first record''',
										        B'''This is the second record''',
										        B'''This is the third record''',
										        B'''This is the fourth record''',
										        B'''This is the fifth record''',
										        B'''This is a longer longer longer record''',
										    ]    ,				dtype=_lowerCAmelCase    ,				)
										return block_records


					def 							_UpperCAmelCase      (      self							)       ->							str:
										_a    	=				RealmRetriever(
										    block_records=self.get_dummy_block_records()    ,				tokenizer=self.get_tokenizer()    ,				)
										return retriever


					def 							_UpperCAmelCase      (      self							)       ->							Union[str, Any]:
										_a    	=				self.get_config()
										_a    	=				self.get_dummy_retriever()
										_a    	=				retriever.tokenizer

										_a    	=				np.array([0, 3]    ,				dtype='''long'''							)
										_a    	=				tokenizer(['''Test question''']							).input_ids
										_a    	=				tokenizer(
										    ['''the fourth''']    ,				add_special_tokens=_lowerCAmelCase    ,				return_token_type_ids=_lowerCAmelCase    ,				return_attention_mask=_lowerCAmelCase    ,				).input_ids
										_a    	=				config.reader_seq_len

										_a	,      _a	,      _a	,      _a    	=				retriever(
										    _lowerCAmelCase    ,				_lowerCAmelCase    ,				answer_ids=_lowerCAmelCase    ,				max_length=_lowerCAmelCase    ,				return_tensors='''np'''							)

										self.assertEqual(len(_lowerCAmelCase							)    ,				2							)
										self.assertEqual(len(_lowerCAmelCase							)    ,				2							)
										self.assertEqual(len(_lowerCAmelCase							)    ,				2							)
										self.assertEqual(concat_inputs.input_ids.shape    ,				(2, 10)							)
										self.assertEqual(concat_inputs.attention_mask.shape    ,				(2, 10)							)
										self.assertEqual(concat_inputs.token_type_ids.shape    ,				(2, 10)							)
										self.assertEqual(concat_inputs.special_tokens_mask.shape    ,				(2, 10)							)
										self.assertEqual(
										    tokenizer.convert_ids_to_tokens(concat_inputs.input_ids[0]							)    ,				['''[CLS]''', '''test''', '''question''', '''[SEP]''', '''this''', '''is''', '''the''', '''first''', '''record''', '''[SEP]''']    ,				)
										self.assertEqual(
										    tokenizer.convert_ids_to_tokens(concat_inputs.input_ids[1]							)    ,				['''[CLS]''', '''test''', '''question''', '''[SEP]''', '''this''', '''is''', '''the''', '''fourth''', '''record''', '''[SEP]''']    ,				)


					def 							_UpperCAmelCase      (      self							)       ->							int:
										_a    	=				self.get_config()
										_a    	=				self.get_dummy_retriever()
										_a    	=				retriever.tokenizer

										_a    	=				np.array([0, 3, 5]    ,				dtype='''long'''							)
										_a    	=				tokenizer(['''Test question''']							).input_ids
										_a    	=				tokenizer(
										    ['''the fourth''', '''longer longer''']    ,				add_special_tokens=_lowerCAmelCase    ,				return_token_type_ids=_lowerCAmelCase    ,				return_attention_mask=_lowerCAmelCase    ,				).input_ids
										_a    	=				config.reader_seq_len

										_a	,      _a	,      _a	,      _a    	=				retriever(
										    _lowerCAmelCase    ,				_lowerCAmelCase    ,				answer_ids=_lowerCAmelCase    ,				max_length=_lowerCAmelCase    ,				return_tensors='''np'''							)

										self.assertEqual([False, True, True]    ,				_lowerCAmelCase							)
										self.assertEqual([[-1, -1, -1], [6, -1, -1], [6, 7, 8]]    ,				_lowerCAmelCase							)
										self.assertEqual([[-1, -1, -1], [7, -1, -1], [7, 8, 9]]    ,				_lowerCAmelCase							)





					def 							_UpperCAmelCase      (      self							)       ->							Optional[int]:
										_a    	=				self.get_dummy_retriever()
										retriever.save_pretrained(os.path.join(self.tmpdirname    ,				'''realm_block_records'''							)							)

										# Test local path
										_a    	=				retriever.from_pretrained(os.path.join(self.tmpdirname    ,				'''realm_block_records'''							)							)
										self.assertEqual(retriever.block_records[0]    ,				B'''This is the first record'''							)

										# Test mocked remote path
										with patch('''transformers.models.realm.retrieval_realm.hf_hub_download'''							) as mock_hf_hub_download:
															_a    	=				os.path.join(
															    os.path.join(self.tmpdirname    ,				'''realm_block_records'''							)    ,				_REALM_BLOCK_RECORDS_FILENAME							)
															_a    	=				RealmRetriever.from_pretrained('''google/realm-cc-news-pretrained-openqa'''							)

										self.assertEqual(retriever.block_records[0]    ,				B'''This is the first record'''							)



"""simple docstring"""






def       A_   (   _lowerCAmelCase     :					int = 10_00       ):






     """simple docstring"""

     _a	,      _a    	=				1, 1
     _a    	=				2
     while True:
          _a    	=				0
          _a    	=				fa + fa
          _a	,      _a    	=				fa, f
          index += 1
          for _ in str(_lowerCAmelCase       ):
               i += 1
          if i == n:
               break
     return index


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