

'''simple docstring'''

from typing import Optional, Tuple

import jax
import jax.numpy as jnp
from flax import linen as nn
from flax.core.frozen_dict import FrozenDict
from transformers import CLIPConfig, FlaxPreTrainedModel
from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule

def 					__UpperCamelCase				(						lowercase__    :	Optional[int],       lowercase__    :	List[Any],       lowercase__    :	Tuple=1E-12			):






     '''simple docstring'''





     __lowercase      		=jnp.divide(emb_a.T,       jnp.clip(jnp.linalg.norm(lowercase__,       axis=1			),       a_min=lowercase__			)			).T
     __lowercase      		=jnp.divide(emb_a.T,       jnp.clip(jnp.linalg.norm(lowercase__,       axis=1			),       a_min=lowercase__			)			).T
     return jnp.matmul(lowercase__,       norm_emb_a.T			)


class 	lowerCAmelCase  (   nn.Module ):
       lowerCAmelCase_												=			42
       lowerCAmelCase_												=			jnp.floataa







       def       snake_case (				self      :			int   ):







            """simple docstring"""







            __lowercase      		=FlaxCLIPVisionModule(self.config.vision_config   )
            __lowercase      		=nn.Dense(self.config.projection_dim    ,   use_bias=__lowercase    ,   dtype=self.dtype   )

            __lowercase      		=self.param('concept_embeds'    ,   jax.nn.initializers.ones    ,   (17, self.config.projection_dim)   )
            __lowercase      		=self.param(
                'special_care_embeds'    ,   jax.nn.initializers.ones    ,   (3, self.config.projection_dim)   )

            __lowercase      		=self.param('concept_embeds_weights'    ,   jax.nn.initializers.ones    ,   (17,)   )
            __lowercase      		=self.param('special_care_embeds_weights'    ,   jax.nn.initializers.ones    ,   (3,)   )







       def __call__(				self      :			List[Any]    ,   __lowercase      :			Optional[int]   ):







            """simple docstring"""







            __lowercase      		=self.vision_model(__lowercase   )[1]
            __lowercase      		=self.visual_projection(__lowercase   )

            __lowercase      		=jax_cosine_distance(__lowercase    ,   self.special_care_embeds   )
            __lowercase      		=jax_cosine_distance(__lowercase    ,   self.concept_embeds   )

            # increase this value to create a stronger `nfsw` filter
            # at the cost of increasing the possibility of filtering benign image inputs
            __lowercase      		=0.0

            __lowercase      		=special_cos_dist - self.special_care_embeds_weights[None, :] + adjustment
            __lowercase      		=jnp.round(__lowercase    ,   3   )
            __lowercase      		=jnp.any(special_scores > 0    ,   axis=1    ,   keepdims=__lowercase   )
            # Use a lower threshold if an image has any special care concept
            __lowercase      		=is_special_care * 0.0_1

            __lowercase      		=cos_dist - self.concept_embeds_weights[None, :] + special_adjustment
            __lowercase      		=jnp.round(__lowercase    ,   3   )
            __lowercase      		=jnp.any(concept_scores > 0    ,   axis=1   )

            return has_nsfw_concepts






class 	lowerCAmelCase  (   A ):
       lowerCAmelCase_												=			CLIPConfig
       lowerCAmelCase_												=			"clip_input"
       lowerCAmelCase_												=			FlaxStableDiffusionSafetyCheckerModule







       def __init__(				self      :			Optional[int]    ,   __lowercase      :			CLIPConfig    ,   __lowercase      :			Optional[Tuple] = None    ,   __lowercase      :			int = 0    ,   __lowercase      :			jnp.dtype = jnp.floataa    ,   __lowercase      :			bool = True    ,   **__lowercase      :			Tuple    ,   ):







            """simple docstring"""







            if input_shape is None:
                 __lowercase      		=(1, 224, 224, 3)
            __lowercase      		=self.module_class(config=__lowercase    ,   dtype=__lowercase    ,   **__lowercase   )
            super().__init__(__lowercase    ,   __lowercase    ,   input_shape=__lowercase    ,   seed=__lowercase    ,   dtype=__lowercase    ,   _do_init=_do_init   )







       def       snake_case (				self      :			Tuple    ,   __lowercase      :			jax.random.KeyArray    ,   __lowercase      :			Tuple    ,   __lowercase      :			FrozenDict = None   ):







            """simple docstring"""







            __lowercase      		=jax.random.normal(__lowercase    ,   __lowercase   )

            __lowercase		,  __lowercase      		=jax.random.split(__lowercase   )
            __lowercase      		={'params': params_rng, 'dropout': dropout_rng}

            __lowercase      		=self.module.init(__lowercase    ,   __lowercase   )['params']

            return random_params







       def __call__(				self      :			Union[str, Any]    ,   __lowercase      :			Optional[int]    ,   __lowercase      :			dict = None    ,   ):







            """simple docstring"""







            __lowercase      		=jnp.transpose(__lowercase    ,   (0, 2, 3, 1)   )

            return self.module.apply(
                {'params': params or self.params}    ,   jnp.array(__lowercase    ,   dtype=jnp.floataa   )    ,   rngs={}    ,   )





'''simple docstring'''

def 					__UpperCamelCase				(						lowercase__    :	int			):






     '''simple docstring'''





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

          return sequence[n]

def 					__UpperCamelCase				(						lowercase__    :	int			):






     '''simple docstring'''





     __lowercase      		=0
     __lowercase      		=2

     while digits < n:
          index += 1
          __lowercase      		=len(str(fibonacci(lowercase__			)			)			)

     return index

def 					__UpperCamelCase				(						lowercase__    :	int = 10_00			):






     '''simple docstring'''





     return fibonacci_digits_index(lowercase__			)


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


