


from __future__ import annotations

import unittest

import numpy as np

from transformers import BlipTextConfig
from transformers.testing_utils import require_tf, slow
from transformers.utils import is_tf_available

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


if is_tf_available():
 import tensorflow as tf

 from transformers import TFBlipTextModel
 from transformers.models.blip.modeling_tf_blip import TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST






class 	__lowercase					:





      def __init__(		self    :       List[Any]       ,							__lowerCamelCase    :       List[Any]       ,							__lowerCamelCase    :       Optional[int]=1_2       ,							__lowerCamelCase    :       str=7       ,							__lowerCamelCase    :       Any=True       ,							__lowerCamelCase    :       Optional[Any]=True       ,							__lowerCamelCase    :       str=True       ,							__lowerCamelCase    :       Any=9_9       ,							__lowerCamelCase    :       List[str]=3_2       ,							__lowerCamelCase    :       Optional[int]=3_2       ,							__lowerCamelCase    :       int=2       ,							__lowerCamelCase    :       Union[str, Any]=4       ,							__lowerCamelCase    :       List[Any]=3_7       ,							__lowerCamelCase    :       Union[str, Any]=0.1       ,							__lowerCamelCase    :       List[Any]=0.1       ,							__lowerCamelCase    :       Optional[Any]=5_1_2       ,							__lowerCamelCase    :       Union[str, Any]=0.02       ,							__lowerCamelCase    :       Any=0       ,							__lowerCamelCase    :       Optional[Any]=None       ,							)     -> List[str]:






         """simple docstring"""







         UpperCAmelCase      					=  parent
         UpperCAmelCase      					=  batch_size
         UpperCAmelCase      					=  seq_length
         UpperCAmelCase      					=  is_training
         UpperCAmelCase      					=  use_input_mask
         UpperCAmelCase      					=  use_labels
         UpperCAmelCase      					=  vocab_size
         UpperCAmelCase      					=  hidden_size
         UpperCAmelCase      					=  projection_dim
         UpperCAmelCase      					=  num_hidden_layers
         UpperCAmelCase      					=  num_attention_heads
         UpperCAmelCase      					=  intermediate_size
         UpperCAmelCase      					=  dropout
         UpperCAmelCase      					=  attention_dropout
         UpperCAmelCase      					=  max_position_embeddings
         UpperCAmelCase      					=  initializer_range
         UpperCAmelCase      					=  scope
         UpperCAmelCase      					=  bos_token_id





      def 							_lowercase					(		self    :       Tuple							)     -> int:






         """simple docstring"""







         UpperCAmelCase      					=  ids_tensor([self.batch_size, self.seq_length]       ,							self.vocab_size							)

         UpperCAmelCase      					=  None
         if self.use_input_mask:
            UpperCAmelCase      					=  random_attention_mask([self.batch_size, self.seq_length]							)

         if input_mask is not None:
            UpperCAmelCase      					=  input_mask.numpy()
            UpperCAmelCase					,	UpperCAmelCase      					=  input_mask.shape
            UpperCAmelCase      					=  np.random.randint(1       ,							seq_length - 1       ,							size=(batch_size,)							)
            for batch_idx, start_index in enumerate(__lowerCamelCase							):
               UpperCAmelCase      					=  1
               UpperCAmelCase      					=  0

         UpperCAmelCase      					=  self.get_config()

         return config, input_ids, tf.convert_to_tensor(__lowerCamelCase							)





      def 							_lowercase					(		self    :       List[Any]							)     -> List[Any]:






         """simple docstring"""







         return BlipTextConfig(
             vocab_size=self.vocab_size       ,							hidden_size=self.hidden_size       ,							projection_dim=self.projection_dim       ,							num_hidden_layers=self.num_hidden_layers       ,							num_attention_heads=self.num_attention_heads       ,							intermediate_size=self.intermediate_size       ,							dropout=self.dropout       ,							attention_dropout=self.attention_dropout       ,							max_position_embeddings=self.max_position_embeddings       ,							initializer_range=self.initializer_range       ,							bos_token_id=self.bos_token_id       ,							)





      def 							_lowercase					(		self    :       Any       ,							__lowerCamelCase    :       Optional[Any]       ,							__lowerCamelCase    :       Dict       ,							__lowerCamelCase    :       Union[str, Any]							)     -> Optional[int]:






         """simple docstring"""







         UpperCAmelCase      					=  TFBlipTextModel(config=__lowerCamelCase							)
         UpperCAmelCase      					=  model(__lowerCamelCase       ,							attention_mask=__lowerCamelCase       ,							training=__lowerCamelCase							)
         UpperCAmelCase      					=  model(__lowerCamelCase       ,							training=__lowerCamelCase							)
         self.parent.assertEqual(result.last_hidden_state.shape       ,							(self.batch_size, self.seq_length, self.hidden_size)							)
         self.parent.assertEqual(result.pooler_output.shape       ,							(self.batch_size, self.hidden_size)							)





      def 							_lowercase					(		self    :       int							)     -> Any:






         """simple docstring"""







         UpperCAmelCase      					=  self.prepare_config_and_inputs()
         UpperCAmelCase					,	UpperCAmelCase					,	UpperCAmelCase      					=  config_and_inputs
         UpperCAmelCase      					=  {"""input_ids""": input_ids, """attention_mask""": input_mask}
         return config, inputs_dict






@require_tf
class 	__lowercase					(	__snake_case			,       unittest.TestCase	):
      UpperCamelCase										=							(TFBlipTextModel,) if is_tf_available() else ()
      UpperCamelCase										=							False
      UpperCamelCase										=							False
      UpperCamelCase										=							False





      def 							_lowercase					(		self    :       int							)     -> Any:






         """simple docstring"""







         UpperCAmelCase      					=  BlipTextModelTester(self							)
         UpperCAmelCase      					=  ConfigTester(self       ,							config_class=__lowerCamelCase       ,							hidden_size=3_7							)





      def 							_lowercase					(		self    :       List[str]							)     -> Dict:






         """simple docstring"""







         self.config_tester.run_common_tests()





      def 							_lowercase					(		self    :       List[str]							)     -> Optional[Any]:






         """simple docstring"""







         UpperCAmelCase      					=  self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_model(*__lowerCamelCase							)





      def 							_lowercase					(		self    :       Dict							)     -> Tuple:






         """simple docstring"""







         pass





      def 							_lowercase					(		self    :       Any							)     -> Tuple:






         """simple docstring"""







         pass





      @unittest.skip(reason="""Blip does not use inputs_embeds"""							)
      def 							_lowercase					(		self    :       Union[str, Any]							)     -> Optional[Any]:






         """simple docstring"""







         pass





      @unittest.skip(reason="""BlipTextModel has no base class and is not available in MODEL_MAPPING"""							)
      def 							_lowercase					(		self    :       Union[str, Any]							)     -> Optional[int]:






         """simple docstring"""







         pass





      @unittest.skip(reason="""BlipTextModel has no base class and is not available in MODEL_MAPPING"""							)
      def 							_lowercase					(		self    :       str							)     -> Any:






         """simple docstring"""







         pass





      @slow
      def 							_lowercase					(		self    :       str							)     -> List[str]:






         """simple docstring"""







         for model_name in TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
            UpperCAmelCase      					=  TFBlipTextModel.from_pretrained(__lowerCamelCase							)
            self.assertIsNotNone(__lowerCamelCase							)





      def 							_lowercase					(		self    :       Dict       ,							__lowerCamelCase    :       int=True							)     -> Optional[Any]:






         """simple docstring"""







         super().test_pt_tf_model_equivalence(allow_missing_keys=__lowerCamelCase							)







def 	_UpperCamelCase					(    lowerCAmelCase_ )    ->int:
   if n == 1 or not isinstance(lowerCAmelCase_	,    lowerCAmelCase_ ):
      return 0
   elif n == 2:
      return 1
   else:
      UpperCAmelCase      					=  [0, 1]
      for i in range(2	,    n + 1 ):
         sequence.append(sequence[i - 1] + sequence[i - 2] )

      return sequence[n]
def 	_UpperCamelCase					(    lowerCAmelCase_ )    ->int:
   UpperCAmelCase      					=  0
   UpperCAmelCase      					=  2

   while digits < n:
      index += 1
      UpperCAmelCase      					=  len(str(fibonacci(lowerCAmelCase_ ) ) )

   return index
def 	_UpperCamelCase					(    lowerCAmelCase_ = 1_0_0_0 )    ->int:
   return fibonacci_digits_index(lowerCAmelCase_ )


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



