





def 						lowerCamelCase__     (     UpperCamelCase__			:       int						)			-> int:



					'''simple docstring'''




					if n == 1 or not isinstance(UpperCamelCase__       ,    UpperCamelCase__						):
										return 0
					elif n == 2:
										return 1
					else:
										_snake_case									=				[0, 1]
										for i in range(2       ,    n + 1						):
															sequence.append(sequence[i - 1] + sequence[i - 2]						)

										return sequence[n]





def 						lowerCamelCase__     (     UpperCamelCase__			:       int						)			-> int:



					'''simple docstring'''




					_snake_case									=				0
					_snake_case									=				2

					while digits < n:
										index += 1
										_snake_case									=				len(str(fibonacci(UpperCamelCase__						)						)						)

					return index





def 						lowerCamelCase__     (     UpperCamelCase__			:       int = 1_000						)			-> int:



					'''simple docstring'''




					return fibonacci_digits_index(UpperCamelCase__						)


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










import argparse
import json
import os
import re
import shutil

import torch

from transformers import BioGptConfig, BioGptForCausalLM
from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES
from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE
from transformers.utils import WEIGHTS_NAME, logging


logging.set_verbosity_warning()

UpperCAmelCase_      							=     2
class 			UpperCamelCase_		:




					def __init__(		self				,						*,  # begin keyword-only arguments
					    lowerCAmelCase_="<s>"				,						lowerCAmelCase_="<pad>"				,						lowerCAmelCase_="</s>"				,						lowerCAmelCase_="<unk>"				,						lowerCAmelCase_=None				,						)		->							Optional[int]:
										_snake_case							,     _snake_case							,     _snake_case							,     _snake_case									=				bos, unk, pad, eos
										_snake_case									=				[]
										_snake_case									=				[]
										_snake_case									=				{}
										_snake_case									=				self.add_symbol(lowerCAmelCase_  )
										_snake_case									=				self.add_symbol(lowerCAmelCase_  )
										_snake_case									=				self.add_symbol(lowerCAmelCase_  )
										_snake_case									=				self.add_symbol(lowerCAmelCase_  )
										if extra_special_symbols:
															for s in extra_special_symbols:
																				self.add_symbol(lowerCAmelCase_  )
										_snake_case									=				len(self.symbols  )




					def __eq__(		self				,						lowerCAmelCase_  )		->							List[Any]:
										return self.indices == other.indices




					def __getitem__(		self				,						lowerCAmelCase_  )		->							Dict:
										if idx < len(self.symbols  ):
															return self.symbols[idx]
										return self.unk_word




					def __len__(		self  )		->							Optional[Any]:
										return len(self.symbols  )




					def __contains__(		self				,						lowerCAmelCase_  )		->							int:
										return sym in self.indices




					@classmethod
					def 	lowerCAmelCase			(		cls				,						lowerCAmelCase_  )		->							List[Any]:
										_snake_case									=				cls()
										d.add_from_file(lowerCAmelCase_  )
										return d




					def 	lowerCAmelCase			(		self				,						lowerCAmelCase_				,						lowerCAmelCase_=1				,						lowerCAmelCase_=False  )		->							str:
										if word in self.indices and not overwrite:
															_snake_case									=				self.indices[word]
															_snake_case									=				self.count[idx] + n
															return idx
										else:
															_snake_case									=				len(self.symbols  )
															_snake_case									=				idx
															self.symbols.append(lowerCAmelCase_  )
															self.count.append(lowerCAmelCase_  )
															return idx




					def 	lowerCAmelCase			(		self				,						lowerCAmelCase_  )		->							Optional[Any]:
										return 0






					def 	lowerCAmelCase			(		self				,						lowerCAmelCase_  )		->							Union[str, Any]:
										if isinstance(lowerCAmelCase_				,						lowerCAmelCase_  ):
															try:
																				with open(lowerCAmelCase_				,						'r'				,						encoding='utf-8'  ) as fd:
																									self.add_from_file(lowerCAmelCase_  )
															except FileNotFoundError as fnfe:
																				raise fnfe
															except UnicodeError:
																				raise Exception('Incorrect encoding detected in {}, please rebuild the dataset'.format(lowerCAmelCase_  )  )
															return

										_snake_case									=				f.readlines()
										_snake_case									=				self._load_meta(lowerCAmelCase_  )

										for line in lines[indices_start_line:]:
															try:
																				_snake_case							,     _snake_case									=				line.rstrip().rsplit(' '				,						1  )
																				if field == "#fairseq:overwrite":
																									_snake_case									=				True
																									_snake_case							,     _snake_case									=				line.rsplit(' '				,						1  )
																				else:
																									_snake_case									=				False
																				_snake_case									=				int(lowerCAmelCase_  )
																				_snake_case									=				line
																				if word in self and not overwrite:
																									raise RuntimeError(
																									    'Duplicate word found when loading Dictionary: \'{}\'. '
																									    'Duplicate words can overwrite earlier ones by adding the '
																									    '#fairseq:overwrite flag at the end of the corresponding row '
																									    'in the dictionary file. If using the Camembert model, please '
																									    'download an updated copy of the model file.'.format(lowerCAmelCase_  )  )
																				self.add_symbol(lowerCAmelCase_				,						n=lowerCAmelCase_				,						overwrite=lowerCAmelCase_  )
															except ValueError:
																				raise ValueError('Incorrect dictionary format, expected \'<token> <cnt> [flags]\''  )





def 						lowerCamelCase__     (     UpperCamelCase__			:       Union[str, Any]						)			-> Tuple:



					'''simple docstring'''




					_snake_case									=				dict((re.sub(R'@@$'       ,    ''       ,    UpperCamelCase__						), v) if k.endswith('@@'						) else (re.sub(R'$'       ,    '</w>'       ,    UpperCamelCase__						), v) for k, v in d.items()						)
					_snake_case									=				'<s> <pad> </s> <unk>'.split()
					# restore the special tokens
					for k in keep_keys:
										del da[F'''{k}</w>''']
										_snake_case									=				d[k]  # restore
					return da





def 						lowerCamelCase__     (     UpperCamelCase__			:       Optional[Any]       ,    UpperCamelCase__			:       Dict						)			-> List[str]:



					'''simple docstring'''




					if not os.path.exists(UpperCamelCase__						):
										raise ValueError(F'''path {biogpt_checkpoint_path} does not exist!'''						)
					os.makedirs(UpperCamelCase__       ,    exist_ok=UpperCamelCase__						)
					print(F'''Writing results to {pytorch_dump_folder_path}'''						)

					# handle various types of models

					_snake_case									=				os.path.join(UpperCamelCase__       ,    'checkpoint.pt'						)
					if not os.path.isfile(UpperCamelCase__						):
										raise ValueError(F'''path to the file {checkpoint_file} does not exist!'''						)
					_snake_case									=				torch.load(UpperCamelCase__       ,    map_location='cpu'						)

					_snake_case									=				chkpt['cfg']['model']

					# dicts
					_snake_case									=				os.path.join(UpperCamelCase__       ,    'dict.txt'						)
					if not os.path.isfile(UpperCamelCase__						):
										raise ValueError(F'''path to the file {dict_file} does not exist!'''						)
					_snake_case									=				Dictionary.load(UpperCamelCase__						)
					_snake_case									=				rewrite_dict_keys(src_dict.indices						)
					_snake_case									=				len(UpperCamelCase__						)
					_snake_case									=				os.path.join(UpperCamelCase__       ,    VOCAB_FILES_NAMES['vocab_file']						)
					print(F'''Generating {src_vocab_file} of {src_vocab_size} records'''						)
					with open(UpperCamelCase__       ,    'w'       ,    encoding='utf-8'						) as f:
										f.write(json.dumps(UpperCamelCase__       ,    ensure_ascii=UpperCamelCase__       ,    indent=UpperCamelCase__						)						)

					# merges_file (bpecodes)
					_snake_case									=				os.path.join(UpperCamelCase__       ,    'bpecodes'						)
					if not os.path.isfile(UpperCamelCase__						):
										raise ValueError(F'''path to the file {bpecodes_file} does not exist!'''						)

					_snake_case									=				os.path.join(UpperCamelCase__       ,    VOCAB_FILES_NAMES['merges_file']						)
					shutil.copyfile(UpperCamelCase__       ,    UpperCamelCase__						)

					# model config
					_snake_case									=				os.path.join(UpperCamelCase__       ,    'config.json'						)

					_snake_case									=				{
					    'activation_dropout': args['activation_dropout'],
					    'architectures': ['BioGptForCausalLM'],
					    'attention_probs_dropout_prob': args['attention_dropout'],
					    'bos_token_id': 0,
					    'eos_token_id': 2,
					    'hidden_act': args['activation_fn'],
					    'hidden_dropout_prob': args['dropout'],
					    'hidden_size': args['decoder_embed_dim'],
					    'initializer_range': 0.02,
					    'intermediate_size': args['decoder_ffn_embed_dim'],
					    'layer_norm_eps': 1e-12,
					    'layerdrop': args['decoder_layerdrop'],
					    'max_position_embeddings': args['max_target_positions'],
					    'model_type': 'biogpt',
					    'num_attention_heads': args['decoder_attention_heads'],
					    'num_hidden_layers': args['decoder_layers'],
					    'pad_token_id': 1,
					    'scale_embedding': not args['no_scale_embedding'],
					    'tie_word_embeddings': args['share_decoder_input_output_embed'],
					    'vocab_size': src_vocab_size,
					}

					# good hparam defaults to start with

					print(F'''Generating {biogpt_model_config_file}'''						)
					with open(UpperCamelCase__       ,    'w'       ,    encoding='utf-8'						) as f:
										f.write(json.dumps(UpperCamelCase__       ,    ensure_ascii=UpperCamelCase__       ,    indent=UpperCamelCase__						)						)

					# tokenizer config
					_snake_case									=				os.path.join(UpperCamelCase__       ,    UpperCamelCase__						)

					_snake_case									=				{
					    'bos_token': '<s>',
					    'eos_token': '</s>',
					    'model_max_length': 1_024,
					    'pad_token': '<pad>',
					    'special_tokens_map_file': None,
					    'tokenizer_class': 'BioGptTokenizer',
					    'unk_token': '<unk>',
					}

					print(F'''Generating {biogpt_tokenizer_config_file}'''						)
					with open(UpperCamelCase__       ,    'w'       ,    encoding='utf-8'						) as f:
										f.write(json.dumps(UpperCamelCase__       ,    ensure_ascii=UpperCamelCase__       ,    indent=UpperCamelCase__						)						)

					# model
					_snake_case									=				chkpt['model']

					# remove unneeded keys
					_snake_case									=				[
					    'decoder.version',
					]
					for k in ignore_keys:
										model_state_dict.pop(UpperCamelCase__       ,    UpperCamelCase__						)

					_snake_case									=				list(model_state_dict.keys()						)
					for layer_name in layer_names:
										if layer_name.endswith('output_projection.weight'						):
															_snake_case									=				model_state_dict.pop(UpperCamelCase__						)
										else:
															_snake_case									=				model_state_dict.pop(UpperCamelCase__						)

					_snake_case									=				BioGptConfig.from_pretrained(UpperCamelCase__						)
					_snake_case									=				BioGptForCausalLM(UpperCamelCase__						)

					# check that it loads ok
					model_new.load_state_dict(UpperCamelCase__						)

					# save
					_snake_case									=				os.path.join(UpperCamelCase__       ,    UpperCamelCase__						)
					print(F'''Generating {pytorch_weights_dump_path}'''						)
					torch.save(UpperCamelCase__       ,    UpperCamelCase__						)

					print('Conversion is done!'						)


if __name__ == "__main__":
					UpperCAmelCase_      							=     argparse.ArgumentParser()
					# Required parameters
					parser.add_argument(
					    """--biogpt_checkpoint_path""",
					    default=None,
					    type=str,
					    required=True,
					    help=(
					        """Path to the official PyTorch checkpoint file which is expected to reside in the dump dir with dicts,"""
					        """ bpecodes, etc."""
					    ),
					)
					parser.add_argument(
					    """--pytorch_dump_folder_path""", default=None, type=str, required=True, help="""Path to the output PyTorch model."""
					)
					UpperCAmelCase_      							=     parser.parse_args()
					convert_biogpt_checkpoint_to_pytorch(args.biogpt_checkpoint_path, args.pytorch_dump_folder_path)



