






"""simple docstring"""



from __future__ import annotations

import os
import tempfile
import unittest

from transformers import ConvBertConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
						import tensorflow as tf

						from transformers import (
						    TFConvBertForMaskedLM,
						    TFConvBertForMultipleChoice,
						    TFConvBertForQuestionAnswering,
						    TFConvBertForSequenceClassification,
						    TFConvBertForTokenClassification,
						    TFConvBertModel,
						)





class 					_UpperCAmelCase       :




					def __init__(				self     :						Union[str, Any]    ,						A     :						str    ,						A     :						List[Any]=13    ,						A     :						int=7    ,						A     :						str=True    ,						A     :						Optional[int]=True    ,						A     :						Any=True    ,						A     :						List[str]=True    ,						A     :						Tuple=99    ,						A     :						Union[str, Any]=32    ,						A     :						Optional[Any]=2    ,						A     :						Dict=4    ,						A     :						int=37    ,						A     :						List[Any]="gelu"    ,						A     :						Any=0.1    ,						A     :						Dict=0.1    ,						A     :						List[str]=5_12    ,						A     :						Any=16    ,						A     :						str=2    ,						A     :						List[Any]=0.02    ,						A     :						int=3    ,						A     :						List[str]=4    ,						A     :						Optional[int]=None    ,						)  ->  Union[str, Any]:
							lowercase_ : List[str]							       =   parent
							lowercase_ : Tuple							       =   13
							lowercase_ : Any							       =   7
							lowercase_ : List[Any]							       =   True
							lowercase_ : Union[str, Any]							       =   True
							lowercase_ : Dict							       =   True
							lowercase_ : str							       =   True
							lowercase_ : str							       =   99
							lowercase_ : Union[str, Any]							       =   3_84
							lowercase_ : List[str]							       =   2
							lowercase_ : Optional[int]							       =   4
							lowercase_ : Dict							       =   37
							lowercase_ : int							       =   '''gelu'''
							lowercase_ : List[Any]							       =   0.1
							lowercase_ : List[str]							       =   0.1
							lowercase_ : int							       =   5_12
							lowercase_ : Optional[Any]							       =   16
							lowercase_ : Optional[int]							       =   2
							lowercase_ : Optional[int]							       =   0.02
							lowercase_ : int							       =   3
							lowercase_ : Union[str, Any]							       =   4
							lowercase_ : Any							       =   1_28
							lowercase_ : Union[str, Any]							       =   2
							lowercase_ : int							       =   9
							lowercase_ : Dict							       =   1
							lowercase_ : str							       =   None




					def   A  (				self     :						Any   )  ->  List[Any]:
							lowercase_ : Union[str, Any]							       =   ids_tensor([self.batch_size, self.seq_length]    ,						self.vocab_size   )

							lowercase_ : Dict							       =   None
							if self.use_input_mask:
									lowercase_ : List[str]							       =   random_attention_mask([self.batch_size, self.seq_length]   )

							lowercase_ : Optional[Any]							       =   None
							if self.use_token_type_ids:
									lowercase_ : Optional[int]							       =   ids_tensor([self.batch_size, self.seq_length]    ,						self.type_vocab_size   )

							lowercase_ : Union[str, Any]							       =   None
							lowercase_ : Any							       =   None
							lowercase_ : str							       =   None
							if self.use_labels:
									lowercase_ : Dict							       =   ids_tensor([self.batch_size]    ,						self.type_sequence_label_size   )
									lowercase_ : Optional[int]							       =   ids_tensor([self.batch_size, self.seq_length]    ,						self.num_labels   )
									lowercase_ : Optional[Any]							       =   ids_tensor([self.batch_size]    ,						self.num_choices   )

							lowercase_ : Optional[int]							       =   ConvBertConfig(
							    vocab_size=self.vocab_size    ,						hidden_size=self.hidden_size    ,						num_hidden_layers=self.num_hidden_layers    ,						num_attention_heads=self.num_attention_heads    ,						intermediate_size=self.intermediate_size    ,						hidden_act=self.hidden_act    ,						hidden_dropout_prob=self.hidden_dropout_prob    ,						attention_probs_dropout_prob=self.attention_probs_dropout_prob    ,						max_position_embeddings=self.max_position_embeddings    ,						type_vocab_size=self.type_vocab_size    ,						initializer_range=self.initializer_range    ,						return_dict=A    ,						)

							return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




					def   A  (				self     :						Optional[Any]    ,						A     :						Union[str, Any]    ,						A     :						Tuple    ,						A     :						Optional[int]    ,						A     :						Tuple    ,						A     :						Any    ,						A     :						Optional[Any]    ,						A     :						str   )  ->  str:
							lowercase_ : Optional[Any]							       =   TFConvBertModel(config=A   )
							lowercase_ : Tuple							       =   {'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}

							lowercase_ : int							       =   [input_ids, input_mask]
							lowercase_ : Optional[Any]							       =   model(A   )

							lowercase_ : Union[str, Any]							       =   model(A   )

							self.parent.assertEqual(result.last_hidden_state.shape    ,						(self.batch_size, self.seq_length, self.hidden_size)   )




					def   A  (				self     :						Union[str, Any]    ,						A     :						Optional[int]    ,						A     :						str    ,						A     :						List[Any]    ,						A     :						int    ,						A     :						Any    ,						A     :						Tuple    ,						A     :						Tuple   )  ->  str:
							lowercase_ : Any							       =   TFConvBertForMaskedLM(config=A   )
							lowercase_ : Dict							       =   {
							    '''input_ids''': input_ids,
							    '''attention_mask''': input_mask,
							    '''token_type_ids''': token_type_ids,
							}
							lowercase_ : List[Any]							       =   model(A   )
							self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.seq_length, self.vocab_size)   )




					def   A  (				self     :						int    ,						A     :						Dict    ,						A     :						Any    ,						A     :						List[str]    ,						A     :						List[Any]    ,						A     :						Optional[int]    ,						A     :						Optional[Any]    ,						A     :						Tuple   )  ->  Optional[int]:
							lowercase_ : str							       =   self.num_labels
							lowercase_ : List[Any]							       =   TFConvBertForSequenceClassification(config=A   )
							lowercase_ : List[Any]							       =   {
							    '''input_ids''': input_ids,
							    '''attention_mask''': input_mask,
							    '''token_type_ids''': token_type_ids,
							}

							lowercase_ : str							       =   model(A   )
							self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.num_labels)   )




					def   A  (				self     :						List[Any]    ,						A     :						List[str]    ,						A     :						Tuple    ,						A     :						int    ,						A     :						Optional[Any]    ,						A     :						Any    ,						A     :						str    ,						A     :						int   )  ->  Union[str, Any]:
							lowercase_ : Any							       =   self.num_choices
							lowercase_ : List[Any]							       =   TFConvBertForMultipleChoice(config=A   )
							lowercase_ : List[str]							       =   tf.tile(tf.expand_dims(A    ,						1   )    ,						(1, self.num_choices, 1)   )
							lowercase_ : Optional[Any]							       =   tf.tile(tf.expand_dims(A    ,						1   )    ,						(1, self.num_choices, 1)   )
							lowercase_ : Optional[Any]							       =   tf.tile(tf.expand_dims(A    ,						1   )    ,						(1, self.num_choices, 1)   )
							lowercase_ : Dict							       =   {
							    '''input_ids''': multiple_choice_inputs_ids,
							    '''attention_mask''': multiple_choice_input_mask,
							    '''token_type_ids''': multiple_choice_token_type_ids,
							}
							lowercase_ : Optional[int]							       =   model(A   )
							self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.num_choices)   )




					def   A  (				self     :						Union[str, Any]    ,						A     :						List[Any]    ,						A     :						Dict    ,						A     :						str    ,						A     :						Optional[Any]    ,						A     :						List[Any]    ,						A     :						Union[str, Any]    ,						A     :						Optional[Any]   )  ->  int:
							lowercase_ : Dict							       =   self.num_labels
							lowercase_ : List[str]							       =   TFConvBertForTokenClassification(config=A   )
							lowercase_ : List[Any]							       =   {
							    '''input_ids''': input_ids,
							    '''attention_mask''': input_mask,
							    '''token_type_ids''': token_type_ids,
							}
							lowercase_ : Optional[Any]							       =   model(A   )
							self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.seq_length, self.num_labels)   )




					def   A  (				self     :						Tuple    ,						A     :						int    ,						A     :						Optional[Any]    ,						A     :						Any    ,						A     :						str    ,						A     :						Union[str, Any]    ,						A     :						int    ,						A     :						Optional[int]   )  ->  List[Any]:
							lowercase_ : Any							       =   TFConvBertForQuestionAnswering(config=A   )
							lowercase_ : Optional[int]							       =   {
							    '''input_ids''': input_ids,
							    '''attention_mask''': input_mask,
							    '''token_type_ids''': token_type_ids,
							}

							lowercase_ : Dict							       =   model(A   )
							self.parent.assertEqual(result.start_logits.shape    ,						(self.batch_size, self.seq_length)   )
							self.parent.assertEqual(result.end_logits.shape    ,						(self.batch_size, self.seq_length)   )






					def   A  (				self     :						List[Any]   )  ->  Optional[Any]:
							lowercase_ : Optional[int]							       =   self.prepare_config_and_inputs()
							(
							    (
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					
							) : Optional[Any]							       =   config_and_inputs
							lowercase_ : List[Any]							       =   {'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
							return config, inputs_dict





@require_tf
class 					_UpperCAmelCase       ( _A   ,						_A   ,						unittest.TestCase							):
					SCREAMING_SNAKE_CASE_		:				Optional[Any]							    =   (
					    (
					        TFConvBertModel,
					        TFConvBertForMaskedLM,
					        TFConvBertForQuestionAnswering,
					        TFConvBertForSequenceClassification,
					        TFConvBertForTokenClassification,
					        TFConvBertForMultipleChoice,
					    )
					    if is_tf_available()
					    else ()
					)
					SCREAMING_SNAKE_CASE_		:				Any							    =   (
					    {
					        "feature-extraction": TFConvBertModel,
					        "fill-mask": TFConvBertForMaskedLM,
					        "question-answering": TFConvBertForQuestionAnswering,
					        "text-classification": TFConvBertForSequenceClassification,
					        "token-classification": TFConvBertForTokenClassification,
					        "zero-shot": TFConvBertForSequenceClassification,
					    }
					    if is_tf_available()
					    else {}
					)
					SCREAMING_SNAKE_CASE_		:				Optional[Any]							    =   False
					SCREAMING_SNAKE_CASE_		:				Optional[Any]							    =   False
					SCREAMING_SNAKE_CASE_		:				List[Any]							    =   False




					def   A  (				self     :						Optional[Any]   )  ->  Tuple:
							lowercase_ : Union[str, Any]							       =   TFConvBertModelTester(self   )
							lowercase_ : Dict							       =   ConfigTester(self    ,						config_class=A    ,						hidden_size=37   )




					def   A  (				self     :						Tuple   )  ->  List[str]:
							self.config_tester.run_common_tests()




					def   A  (				self     :						Union[str, Any]   )  ->  List[Any]:
							lowercase_ : Any							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*A   )




					def   A  (				self     :						Optional[Any]   )  ->  Tuple:
							lowercase_ : str							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_masked_lm(*A   )




					def   A  (				self     :						Tuple   )  ->  Any:
							lowercase_ : List[Any]							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_multiple_choice(*A   )




					def   A  (				self     :						Dict   )  ->  Tuple:
							lowercase_ : List[str]							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_question_answering(*A   )




					def   A  (				self     :						Optional[int]   )  ->  str:
							lowercase_ : str							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_sequence_classification(*A   )




					def   A  (				self     :						str   )  ->  int:
							lowercase_ : Optional[Any]							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_token_classification(*A   )




					@slow
					def   A  (				self     :						Optional[Any]   )  ->  Dict:
							lowercase_       ,					lowercase_ : Tuple							       =   self.model_tester.prepare_config_and_inputs_for_common()
							lowercase_ : Optional[Any]							       =   True
							lowercase_ : str							       =   True

							if hasattr(A    ,						'''use_cache'''   ):
									lowercase_ : int							       =   True

							lowercase_ : Dict							       =   getattr(self.model_tester    ,						'''encoder_seq_length'''    ,						self.model_tester.seq_length   )
							lowercase_ : Union[str, Any]							       =   getattr(self.model_tester    ,						'''key_length'''    ,						A   )

							for model_class in self.all_model_classes:
									lowercase_ : List[str]							       =   self._prepare_for_class(A    ,						A   )
									lowercase_ : str							       =   model_class(A   )
									lowercase_ : Any							       =   len(model(A   )   )

									with tempfile.TemporaryDirectory() as tmpdirname:
											model.save_pretrained(A    ,						saved_model=A   )
											lowercase_ : Optional[int]							       =   os.path.join(A    ,						'''saved_model'''    ,						'''1'''   )
											lowercase_ : List[Any]							       =   tf.keras.models.load_model(A   )
											lowercase_ : List[str]							       =   model(A   )

											if self.is_encoder_decoder:
													lowercase_ : Any							       =   outputs['''encoder_hidden_states''']
													lowercase_ : List[str]							       =   outputs['''encoder_attentions''']
											else:
													lowercase_ : Optional[int]							       =   outputs['''hidden_states''']
													lowercase_ : Tuple							       =   outputs['''attentions''']

											self.assertEqual(len(A   )    ,						A   )

											lowercase_ : Any							       =   getattr(
											    self.model_tester    ,						'''expected_num_hidden_layers'''    ,						self.model_tester.num_hidden_layers + 1   )

											self.assertEqual(len(A   )    ,						A   )
											self.assertListEqual(
											    list(output_hidden_states[0].shape[-2:]   )    ,						[self.model_tester.seq_length, self.model_tester.hidden_size]    ,						)

											self.assertEqual(len(A   )    ,						self.model_tester.num_hidden_layers   )
											self.assertListEqual(
											    list(output_attentions[0].shape[-3:]   )    ,						[self.model_tester.num_attention_heads / 2, encoder_seq_length, encoder_key_length]    ,						)




					@slow
					def   A  (				self     :						Optional[Any]   )  ->  Tuple:
							lowercase_ : List[Any]							       =   TFConvBertModel.from_pretrained('''YituTech/conv-bert-base'''   )
							self.assertIsNotNone(A   )






					def   A  (				self     :						List[str]   )  ->  Optional[int]:
							lowercase_       ,					lowercase_ : Any							       =   self.model_tester.prepare_config_and_inputs_for_common()
							lowercase_ : List[str]							       =   True
							lowercase_ : Optional[int]							       =   getattr(self.model_tester    ,						'''decoder_seq_length'''    ,						self.model_tester.seq_length   )
							lowercase_ : List[str]							       =   getattr(self.model_tester    ,						'''encoder_seq_length'''    ,						self.model_tester.seq_length   )
							lowercase_ : Any							       =   getattr(self.model_tester    ,						'''key_length'''    ,						A   )
							lowercase_ : List[Any]							       =   getattr(self.model_tester    ,						'''key_length'''    ,						A   )

							def check_decoder_attentions_output(A     :						str   ):
									lowercase_ : int							       =   len(A   )
									self.assertEqual(out_len % 2    ,						0   )
									lowercase_ : Dict							       =   outputs.decoder_attentions
									self.assertEqual(len(A   )    ,						self.model_tester.num_hidden_layers   )
									self.assertListEqual(
									    list(decoder_attentions[0].shape[-3:]   )    ,						[self.model_tester.num_attention_heads / 2, decoder_seq_length, decoder_key_length]    ,						)

							def check_encoder_attentions_output(A     :						Any   ):
									lowercase_ : int							       =   [
									    t.numpy() for t in (outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions)
									]
									self.assertEqual(len(A   )    ,						self.model_tester.num_hidden_layers   )
									self.assertListEqual(
									    list(attentions[0].shape[-3:]   )    ,						[self.model_tester.num_attention_heads / 2, encoder_seq_length, encoder_key_length]    ,						)

							for model_class in self.all_model_classes:
									lowercase_ : Optional[Any]							       =   True
									lowercase_ : List[Any]							       =   False
									lowercase_ : int							       =   model_class(A   )
									lowercase_ : Union[str, Any]							       =   model(self._prepare_for_class(A    ,						A   )   )
									lowercase_ : str							       =   len(A   )
									self.assertEqual(config.output_hidden_states    ,						A   )
									check_encoder_attentions_output(A   )

									if self.is_encoder_decoder:
											lowercase_ : Any							       =   model_class(A   )
											lowercase_ : List[str]							       =   model(self._prepare_for_class(A    ,						A   )   )
											self.assertEqual(config.output_hidden_states    ,						A   )
											check_decoder_attentions_output(A   )

									# Check that output attentions can also be changed via the config
									del inputs_dict["output_attentions"]
									lowercase_ : Dict							       =   True
									lowercase_ : Any							       =   model_class(A   )
									lowercase_ : Tuple							       =   model(self._prepare_for_class(A    ,						A   )   )
									self.assertEqual(config.output_hidden_states    ,						A   )
									check_encoder_attentions_output(A   )

									# Check attention is always last and order is fine
									lowercase_ : Optional[Any]							       =   True
									lowercase_ : Dict							       =   True
									lowercase_ : Any							       =   model_class(A   )
									lowercase_ : Optional[Any]							       =   model(self._prepare_for_class(A    ,						A   )   )

									self.assertEqual(out_len + (2 if self.is_encoder_decoder else 1)    ,						len(A   )   )
									self.assertEqual(model.config.output_hidden_states    ,						A   )
									check_encoder_attentions_output(A   )





@require_tf
class 					_UpperCAmelCase       ( unittest.TestCase							):




					@slow
					def   A  (				self     :						List[str]   )  ->  Dict:
							lowercase_ : Dict							       =   TFConvBertModel.from_pretrained('''YituTech/conv-bert-base'''   )
							lowercase_ : Union[str, Any]							       =   tf.constant([[0, 1, 2, 3, 4, 5]]   )
							lowercase_ : Union[str, Any]							       =   model(A   )[0]

							lowercase_ : List[Any]							       =   [1, 6, 7_68]
							self.assertEqual(output.shape    ,						A   )

							lowercase_ : Union[str, Any]							       =   tf.constant(
							    [
							        [
							            [-0.03475493, -0.4686034, -0.30638832],
							            [0.22637248, -0.26988646, -0.7423424],
							            [0.10324868, -0.45013508, -0.58280784],
							        ]
							    ]   )
							tf.debugging.assert_near(output[:, :3, :3]    ,						A    ,						atol=1e-4   )











"""simple docstring"""



def 						lowercase    (				__snake_case				: int	):
		if n == 1 or not isinstance(__snake_case		,					__snake_case	):
				return 0
		elif n == 2:
				return 1
		else:
				lowercase_ : Dict							       =   [0, 1]
				for i in range(2		,					n + 1	):
						sequence.append(sequence[i - 1] + sequence[i - 2]	)

				return sequence[n]



def 						lowercase    (				__snake_case				: int	):
		lowercase_ : str							       =   0
		lowercase_ : List[str]							       =   2

		while digits < n:
				index += 1
				lowercase_ : Any							       =   len(str(fibonacci(__snake_case	)	)	)

		return index



def 						lowercase    (				__snake_case				: int = 1_0_0_0	):
		return fibonacci_digits_index(__snake_case	)


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



