
"""simple docstring"""



import inspect

import jax
import jax.lax as lax
import jax.numpy as jnp

from ..utils import add_start_docstrings
from ..utils.logging import get_logger


a       :						Optional[Any]       		=		get_logger(__name__)


a       :						Optional[int]       		=		r'''
    Args:
        input_ids (`jnp.ndarray` of shape `(batch_size, sequence_length)`):
            Indices of input sequence tokens in the vocabulary.

            Indices can be obtained using [`PreTrainedTokenizer`]. See [`PreTrainedTokenizer.encode`] and
            [`PreTrainedTokenizer.__call__`] for details.

            [What are input IDs?](../glossary#input-ids)
        scores (`jnp.ndarray` of shape `(batch_size, config.vocab_size)`):
            Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
            search or log softmax for each vocabulary token when using beam search
        kwargs (`Dict[str, Any]`, *optional*):
            Additional logits processor specific kwargs.

    Return:
        `jnp.ndarray` of shape `(batch_size, config.vocab_size)`: The processed prediction scores.

'''




class 		a_    :







    @add_start_docstrings(__UpperCamelCase  )
    def __call__(      self      :							Optional[int]  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  )		->jnp.ndarray:






        '''simple docstring'''






        raise NotImplementedError(
            f"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""  )







class 		a_    :







    @add_start_docstrings(__UpperCamelCase  )
    def __call__(      self      :							Dict  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  )		->jnp.ndarray:






        '''simple docstring'''






        raise NotImplementedError(
            f"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""  )







class 		a_    (			_UpperCAmelCase						):







    @add_start_docstrings(__UpperCamelCase  )
    def __call__(      self      :							Optional[int]  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  ,       **__UpperCamelCase      :							List[Any]  )		->jnp.ndarray:






        '''simple docstring'''






        for processor in self:
            _UpperCAmelCase        = inspect.signature(processor.__call__  ).parameters
            if len(__UpperCamelCase  ) > 3:
                if not all(arg in kwargs for arg in list(function_args.keys()  )[2:]  ):
                    raise ValueError(
                        f"""Make sure that all the required parameters: {list(function_args.keys()  )} for """
                        f"""{processor.__class__} are passed to the logits processor."""  )
                _UpperCAmelCase        = processor(__UpperCamelCase  ,       __UpperCamelCase  ,       __UpperCamelCase  ,       **__UpperCamelCase  )
            else:
                _UpperCAmelCase        = processor(__UpperCamelCase  ,       __UpperCamelCase  ,       __UpperCamelCase  )
        return scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							Optional[Any]  ,       __UpperCamelCase      :							float  )		->Tuple:






        '''simple docstring'''






        if not isinstance(__UpperCamelCase  ,       __UpperCamelCase  ) or not (temperature > 0):
            raise ValueError(f"""`temperature` has to be a strictly positive float, but is {temperature}"""  )

        _UpperCAmelCase        = temperature







    def __call__(      self      :							List[str]  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  )		->jnp.ndarray:






        '''simple docstring'''






        _UpperCAmelCase        = scores / self.temperature
        return scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							List[Any]  ,       __UpperCamelCase      :							float  ,       __UpperCamelCase      :							float = -float("""Inf"""  )  ,       __UpperCamelCase      :							int = 1  )		->Dict:






        '''simple docstring'''






        if not isinstance(__UpperCamelCase  ,       __UpperCamelCase  ) or (top_p < 0 or top_p > 1.0):
            raise ValueError(f"""`top_p` has to be a float > 0 and < 1, but is {top_p}"""  )
        if not isinstance(__UpperCamelCase  ,       __UpperCamelCase  ) or (min_tokens_to_keep < 1):
            raise ValueError(f"""`min_tokens_to_keep` has to be a positive integer, but is {min_tokens_to_keep}"""  )

        _UpperCAmelCase        = top_p
        _UpperCAmelCase        = filter_value
        _UpperCAmelCase        = min_tokens_to_keep







    def __call__(      self      :							Tuple  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  )		->jnp.ndarray:






        '''simple docstring'''






        _UpperCAmelCase     ,_UpperCAmelCase        = lax.top_k(__UpperCamelCase  ,       scores.shape[-1]  )

        _UpperCAmelCase        = jnp.full_like(__UpperCamelCase  ,       self.filter_value  )
        _UpperCAmelCase        = jax.nn.softmax(__UpperCamelCase  ,       axis=-1  ).cumsum(axis=-1  )
        _UpperCAmelCase        = cumulative_probs < self.top_p

        # include the token that is higher than top_p as well
        _UpperCAmelCase        = jnp.roll(__UpperCamelCase  ,       1  )
        score_mask |= score_mask.at[:, 0].set(__UpperCamelCase  )

        # min tokens to keep
        _UpperCAmelCase        = score_mask.at[:, : self.min_tokens_to_keep].set(__UpperCamelCase  )

        _UpperCAmelCase        = jnp.where(__UpperCamelCase  ,       __UpperCamelCase  ,       __UpperCamelCase  )
        _UpperCAmelCase        = jax.lax.sort_key_val(__UpperCamelCase  ,       __UpperCamelCase  )[-1]

        return next_scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							Tuple  ,       __UpperCamelCase      :							int  ,       __UpperCamelCase      :							float = -float("""Inf"""  )  ,       __UpperCamelCase      :							int = 1  )		->List[str]:






        '''simple docstring'''






        if not isinstance(__UpperCamelCase  ,       __UpperCamelCase  ) or top_k <= 0:
            raise ValueError(f"""`top_k` has to be a strictly positive integer, but is {top_k}"""  )

        _UpperCAmelCase        = max(__UpperCamelCase  ,       __UpperCamelCase  )
        _UpperCAmelCase        = filter_value







    def __call__(      self      :							str  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  )		->jnp.ndarray:






        '''simple docstring'''






        _UpperCAmelCase     ,_UpperCAmelCase        = scores.shape
        _UpperCAmelCase        = jnp.full(batch_size * vocab_size  ,       self.filter_value  )

        _UpperCAmelCase        = min(self.top_k  ,       scores.shape[-1]  )  # Safety check
        _UpperCAmelCase     ,_UpperCAmelCase        = lax.top_k(__UpperCamelCase  ,       __UpperCamelCase  )
        _UpperCAmelCase        = jnp.broadcast_to((jnp.arange(__UpperCamelCase  ) * vocab_size)[:, None]  ,       (batch_size, topk)  ).flatten()
        _UpperCAmelCase        = topk_scores.flatten()
        _UpperCAmelCase        = topk_indices.flatten() + shift

        _UpperCAmelCase        = next_scores_flat.at[topk_indices_flat].set(__UpperCamelCase  )
        _UpperCAmelCase        = next_scores_flat.reshape(__UpperCamelCase  ,       __UpperCamelCase  )
        return next_scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							int  ,       __UpperCamelCase      :							int  )		->int:






        '''simple docstring'''






        _UpperCAmelCase        = bos_token_id







    def __call__(      self      :							Optional[int]  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  )		->jnp.ndarray:






        '''simple docstring'''






        _UpperCAmelCase        = jnp.full(scores.shape  ,       -float("""inf"""  )  )

        _UpperCAmelCase        = 1 - jnp.bool_(cur_len - 1  )

        _UpperCAmelCase        = jnp.where(__UpperCamelCase  ,       new_scores.at[:, self.bos_token_id].set(0  )  ,       __UpperCamelCase  )

        return scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							Dict  ,       __UpperCamelCase      :							int  ,       __UpperCamelCase      :							int  )		->List[str]:






        '''simple docstring'''






        _UpperCAmelCase        = max_length
        _UpperCAmelCase        = eos_token_id







    def __call__(      self      :							Dict  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  )		->jnp.ndarray:






        '''simple docstring'''






        _UpperCAmelCase        = jnp.full(scores.shape  ,       -float("""inf"""  )  )

        _UpperCAmelCase        = 1 - jnp.bool_(cur_len - self.max_length + 1  )

        _UpperCAmelCase        = jnp.where(__UpperCamelCase  ,       new_scores.at[:, self.eos_token_id].set(0  )  ,       __UpperCamelCase  )

        return scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							Tuple  ,       __UpperCamelCase      :							int  ,       __UpperCamelCase      :							int  )		->str:






        '''simple docstring'''






        if not isinstance(__UpperCamelCase  ,       __UpperCamelCase  ) or min_length < 0:
            raise ValueError(f"""`min_length` has to be a positive integer, but is {min_length}"""  )

        if not isinstance(__UpperCamelCase  ,       __UpperCamelCase  ) or eos_token_id < 0:
            raise ValueError(f"""`eos_token_id` has to be a positive integer, but is {eos_token_id}"""  )

        _UpperCAmelCase        = min_length
        _UpperCAmelCase        = eos_token_id







    def __call__(      self      :							int  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  )		->jnp.ndarray:






        '''simple docstring'''






        _UpperCAmelCase        = 1 - jnp.clip(cur_len - self.min_length  ,       0  ,       1  )

        _UpperCAmelCase        = jnp.where(__UpperCamelCase  ,       scores.at[:, self.eos_token_id].set(-float("""inf"""  )  )  ,       __UpperCamelCase  )

        return scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							Union[str, Any]  ,       __UpperCamelCase      :							int  ,       __UpperCamelCase      :							Dict  )		->int:






        '''simple docstring'''






        _UpperCAmelCase        = list(__UpperCamelCase  )
        _UpperCAmelCase        = begin_index







    def __call__(      self      :							int  ,       __UpperCamelCase      :							Optional[Any]  ,       __UpperCamelCase      :							Optional[int]  ,       __UpperCamelCase      :							int  )		->Optional[Any]:






        '''simple docstring'''






        _UpperCAmelCase        = 1 - jnp.bool_(cur_len - self.begin_index  )

        _UpperCAmelCase        = jnp.where(__UpperCamelCase  ,       scores.at[:, self.begin_suppress_tokens].set(-float("""inf"""  )  )  ,       __UpperCamelCase  )

        return scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							Optional[Any]  ,       __UpperCamelCase      :							list  )		->Dict:






        '''simple docstring'''






        _UpperCAmelCase        = list(__UpperCamelCase  )







    def __call__(      self      :							Optional[int]  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  )		->jnp.ndarray:






        '''simple docstring'''






        _UpperCAmelCase        = scores.at[..., self.suppress_tokens].set(-float("""inf"""  )  )

        return scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							Any  ,       __UpperCamelCase      :							Optional[Any]  )		->Dict:






        '''simple docstring'''






        _UpperCAmelCase        = dict(__UpperCamelCase  )
        # Converts the dictionary of format {index: token} containing the tokens to be forced to an array, where the
        # index of the array corresponds to the index of the token to be forced, for XLA compatibility.
        # Indexes without forced tokens will have a negative value.
        _UpperCAmelCase        = jnp.ones((max(force_token_map.keys()  ) + 1)  ,       dtype=jnp.intaa  ) * -1
        for index, token in force_token_map.items():
            if token is not None:
                _UpperCAmelCase        = force_token_array.at[index].set(__UpperCamelCase  )
        _UpperCAmelCase        = jnp.intaa(__UpperCamelCase  )







    def __call__(      self      :							Optional[int]  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							jnp.ndarray  ,       __UpperCamelCase      :							int  )		->jnp.ndarray:






        '''simple docstring'''






        def _force_token(__UpperCamelCase      :							Optional[int]  ):
            _UpperCAmelCase        = scores.shape[0]
            _UpperCAmelCase        = self.force_token_array[generation_idx]

            _UpperCAmelCase        = jnp.ones_like(__UpperCamelCase  ,       dtype=scores.dtype  ) * -float("""inf"""  )
            _UpperCAmelCase        = jnp.zeros((batch_size, 1)  ,       dtype=scores.dtype  )
            _UpperCAmelCase        = lax.dynamic_update_slice(__UpperCamelCase  ,       __UpperCamelCase  ,       (0, current_token)  )
            return new_scores

        _UpperCAmelCase        = lax.cond(
            cur_len >= self.force_token_array.shape[0]  ,       lambda: scores  ,       lambda: lax.cond(
                self.force_token_array[cur_len] >= 0  ,       lambda: _force_token(__UpperCamelCase  )  ,       lambda: scores  ,       )  ,       )
        return scores







class 		a_    (			_UpperCAmelCase						):







    def __init__(      self      :							Union[str, Any]  ,       __UpperCamelCase      :							Tuple  ,       __UpperCamelCase      :							Optional[Any]  ,       __UpperCamelCase      :							List[str]  )		->Union[str, Any]:






        '''simple docstring'''






        _UpperCAmelCase        = generate_config.eos_token_id
        _UpperCAmelCase        = generate_config.no_timestamps_token_id
        _UpperCAmelCase        = generate_config.no_timestamps_token_id + 1

        _UpperCAmelCase        = decoder_input_length + 1

        if generate_config.is_multilingual:
            # room for language token and task token
            self.begin_index += 2
        if hasattr(__UpperCamelCase  ,       """max_initial_timestamp_index"""  ):
            _UpperCAmelCase        = generate_config.max_initial_timestamp_index
        else:
            _UpperCAmelCase        = model_config.vocab_size
        if self.max_initial_timestamp_index is None:
            _UpperCAmelCase        = model_config.vocab_size







    def __call__(      self      :							Optional[int]  ,       __UpperCamelCase      :							Tuple  ,       __UpperCamelCase      :							List[str]  ,       __UpperCamelCase      :							List[str]  )		->Tuple:






        '''simple docstring'''






        _UpperCAmelCase        = scores.at[:, self.no_timestamps_token_id].set(-float("""inf"""  )  )

        def handle_pairs(__UpperCamelCase      :							Union[str, Any]  ,       __UpperCamelCase      :							Any  ):
            _UpperCAmelCase        = jnp.where((cur_len - self.begin_index) >= 1  ,       __UpperCamelCase  ,       __UpperCamelCase  )
            _UpperCAmelCase        = jnp.where(
                input_ids_k[cur_len - 1] >= self.timestamp_begin  ,       True and last_was_timestamp  ,       __UpperCamelCase  ,       )

            _UpperCAmelCase        = jnp.where((cur_len - self.begin_index) < 2  ,       __UpperCamelCase  ,       __UpperCamelCase  )
            _UpperCAmelCase        = jnp.where(
                input_ids_k[cur_len - 2] >= self.timestamp_begin  ,       __UpperCamelCase  ,       __UpperCamelCase  ,       )

            return jnp.where(
                __UpperCamelCase  ,       jnp.where(
                    penultimate_was_timestamp > 0  ,       scores_k.at[self.timestamp_begin :].set(-float("""inf"""  )  )  ,       scores_k.at[: self.eos_token_id].set(-float("""inf"""  )  )  ,       )  ,       __UpperCamelCase  ,       )

        _UpperCAmelCase        = jax.vmap(__UpperCamelCase  )(__UpperCamelCase  ,       __UpperCamelCase  )

        _UpperCAmelCase        = jnp.where(cur_len == self.begin_index  ,       __UpperCamelCase  ,       __UpperCamelCase  )
        _UpperCAmelCase        = jnp.where(
            self.max_initial_timestamp_index is not None  ,       True and apply_max_initial_timestamp  ,       __UpperCamelCase  ,       )

        _UpperCAmelCase        = self.timestamp_begin + self.max_initial_timestamp_index

        _UpperCAmelCase        = jnp.where(
            __UpperCamelCase  ,       scores.at[:, last_allowed + 1 :].set(-float("""inf"""  )  )  ,       __UpperCamelCase  ,       )

        # if sum of probability over timestamps is above any other token, sample timestamp
        _UpperCAmelCase        = jax.nn.log_softmax(__UpperCamelCase  ,       axis=-1  )

        def handle_cumulative_probs(__UpperCamelCase      :							Optional[Any]  ,       __UpperCamelCase      :							Tuple  ):
            _UpperCAmelCase        = jax.nn.logsumexp(logprobs_k[self.timestamp_begin :]  ,       axis=-1  )
            _UpperCAmelCase        = jnp.max(logprobs_k[: self.timestamp_begin]  )
            return jnp.where(
                timestamp_logprob > max_text_token_logprob  ,       scores_k.at[: self.timestamp_begin].set(-float("""inf"""  )  )  ,       __UpperCamelCase  ,       )

        _UpperCAmelCase        = jax.vmap(__UpperCamelCase  )(__UpperCamelCase  ,       __UpperCamelCase  )

        return scores

"""simple docstring"""



def 			_UpperCamelCase						(    _A = 1_0_0_0   )     ->	int:





    """simple docstring"""

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


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