

"""simple docstring"""
def 					a__						(						lowerCAmelCase    )	-> int:
      UpperCAmelCase__			:							Tuple							=    0
      while num > 0:
            digit_sum += num % 10
            num //= 10
      return digit_sum




def 					a__						(						lowerCAmelCase = 1_00    )	-> int:
      UpperCAmelCase__			:							Tuple							=    1
      UpperCAmelCase__			:							Optional[int]							=    2

      for i in range(2			,	max_n + 1    ):
            UpperCAmelCase__			:							Dict							=    pre_numerator
            UpperCAmelCase__			:							List[Any]							=    2 * i // 3 if i % 3 == 0 else 1
            UpperCAmelCase__			:							Optional[int]							=    cur_numerator
            UpperCAmelCase__			:							Dict							=    e_cont * pre_numerator + temp

      return sum_digits(lowerCAmelCase    )


if __name__ == "__main__":
    print(f'''{solution() = }''')




"""simple docstring"""
import warnings
from typing import Dict, List, Optional, Tuple

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


_A							=  logging.get_logger(__name__)

class       lowerCamelCase	(       lowerCAmelCase__   ):


  '''simple docstring'''







  SCREAMING_SNAKE_CASE					      =  ['input_ids', 'attention_mask']



  def __init__(self							,       _lowerCamelCase="</s>"							,       _lowerCamelCase="<unk>"							,       _lowerCamelCase="<pad>"							,       _lowerCamelCase=125							,       _lowerCamelCase=None							,       **_lowerCamelCase							,       ):


        """simple docstring"""

        if extra_ids > 0 and additional_special_tokens is None:
              UpperCAmelCase__			:							List[str]							=    [F"""<extra_id_{i}>""" for i in range(_lowerCamelCase	)]
        elif extra_ids > 0 and additional_special_tokens is not None:
              # Check that we have the right number of extra_id special tokens
              UpperCAmelCase__			:							int							=    len(set(filter(lambda _lowerCamelCase	: bool("""extra_id""" in str(_lowerCamelCase	)	)							,       _lowerCamelCase	)	)	)
              if extra_tokens != extra_ids:
                    raise ValueError(
                        F"""Both extra_ids ({extra_ids}) and additional_special_tokens ({additional_special_tokens}) are"""
                        """ provided to ByT5Tokenizer. In this case the additional_special_tokens must include the"""
                        """ extra_ids tokens"""	)

        UpperCAmelCase__			:							List[str]							=    AddedToken(_lowerCamelCase							,       lstrip=_lowerCamelCase							,       rstrip=_lowerCamelCase	) if isinstance(_lowerCamelCase							,       _lowerCamelCase	) else pad_token
        UpperCAmelCase__			:							int							=    AddedToken(_lowerCamelCase							,       lstrip=_lowerCamelCase							,       rstrip=_lowerCamelCase	) if isinstance(_lowerCamelCase							,       _lowerCamelCase	) else eos_token
        UpperCAmelCase__			:							Optional[int]							=    AddedToken(_lowerCamelCase							,       lstrip=_lowerCamelCase							,       rstrip=_lowerCamelCase	) if isinstance(_lowerCamelCase							,       _lowerCamelCase	) else unk_token

        super().__init__(
            eos_token=_lowerCamelCase							,       unk_token=_lowerCamelCase							,       pad_token=_lowerCamelCase							,       extra_ids=_lowerCamelCase							,       additional_special_tokens=_lowerCamelCase							,       **_lowerCamelCase							,       )

        UpperCAmelCase__			:							int							=    extra_ids

        UpperCAmelCase__			:							List[str]							=    2**8  # utf is 8 bits

        # define special tokens dict
        UpperCAmelCase__			:							Dict[int, str]							=    {
            self.pad_token: 0,
            self.eos_token: 1,
            self.unk_token: 2,
        }
        UpperCAmelCase__			:							str							=    len(self.special_tokens_encoder	)
        UpperCAmelCase__			:							Union[str, Any]							=    len(_lowerCamelCase	)
        for i, token in enumerate(_lowerCamelCase	):
              UpperCAmelCase__			:							Optional[Any]							=    self.vocab_size + i - n
        UpperCAmelCase__			:							Dict[str, int]							=    {v: k for k, v in self.special_tokens_encoder.items()}



  @property
  def  _a      (self	):


        """simple docstring"""

        return self._utf_vocab_size + self._num_special_tokens + self._extra_ids



  def  _a      (self							,       _lowerCamelCase							,       _lowerCamelCase = None							,       _lowerCamelCase = False	):


        """simple docstring"""

        if already_has_special_tokens:
              return super().get_special_tokens_mask(
                  token_ids_a=_lowerCamelCase							,       token_ids_a=_lowerCamelCase							,       already_has_special_tokens=_lowerCamelCase	)

        # normal case: some special tokens
        if token_ids_a is None:
              return ([0] * len(_lowerCamelCase	)) + [1]
        return ([0] * len(_lowerCamelCase	)) + [1] + ([0] * len(_lowerCamelCase	)) + [1]



  def  _a      (self							,       _lowerCamelCase	):


        """simple docstring"""

        if len(_lowerCamelCase	) > 0 and token_ids[-1] == self.eos_token_id:
              warnings.warn(
                  F"""This sequence already has {self.eos_token}. In future versions this behavior may lead to duplicated"""
                  """ eos tokens being added."""	)
              return token_ids
        else:
              return token_ids + [self.eos_token_id]



  def  _a      (self							,       _lowerCamelCase							,       _lowerCamelCase = None	):


        """simple docstring"""

        UpperCAmelCase__			:							List[str]							=    [self.eos_token_id]

        if token_ids_a is None:
              return len(token_ids_a + eos	) * [0]
        return len(token_ids_a + eos + token_ids_a + eos	) * [0]



  def  _a      (self							,       _lowerCamelCase							,       _lowerCamelCase = None	):


        """simple docstring"""

        UpperCAmelCase__			:							Tuple							=    self._add_eos_if_not_present(_lowerCamelCase	)
        if token_ids_a is None:
              return token_ids_a
        else:
              UpperCAmelCase__			:							List[str]							=    self._add_eos_if_not_present(_lowerCamelCase	)
              return token_ids_a + token_ids_a



  def  _a      (self							,       _lowerCamelCase	):


        """simple docstring"""

        UpperCAmelCase__			:							Optional[Any]							=    [chr(_lowerCamelCase	) for i in text.encode("""utf-8"""	)]
        return tokens



  def  _a      (self							,       _lowerCamelCase	):


        """simple docstring"""

        if token in self.special_tokens_encoder:
              UpperCAmelCase__			:							List[str]							=    self.special_tokens_encoder[token]
        elif token in self.added_tokens_encoder:
              UpperCAmelCase__			:							Tuple							=    self.added_tokens_encoder[token]
        elif len(_lowerCamelCase	) != 1:
              UpperCAmelCase__			:							Dict							=    self.unk_token_id
        else:
              UpperCAmelCase__			:							Tuple							=    ord(_lowerCamelCase	) + self._num_special_tokens
        return token_id



  def  _a      (self							,       _lowerCamelCase	):


        """simple docstring"""

        if index in self.special_tokens_decoder:
              UpperCAmelCase__			:							Optional[Any]							=    self.special_tokens_decoder[index]
        else:
              UpperCAmelCase__			:							Dict							=    chr(index - self._num_special_tokens	)
        return token



  def  _a      (self							,       _lowerCamelCase	):


        """simple docstring"""

        UpperCAmelCase__			:							List[Any]							=    B""""""
        for token in tokens:
              if token in self.special_tokens_decoder:
                    UpperCAmelCase__			:							Tuple							=    self.special_tokens_decoder[token].encode("""utf-8"""	)
              elif token in self.added_tokens_decoder:
                    UpperCAmelCase__			:							Optional[Any]							=    self.special_tokens_decoder[token].encode("""utf-8"""	)
              elif token in self.special_tokens_encoder:
                    UpperCAmelCase__			:							str							=    token.encode("""utf-8"""	)
              elif token in self.added_tokens_encoder:
                    UpperCAmelCase__			:							List[Any]							=    token.encode("""utf-8"""	)
              else:
                    UpperCAmelCase__			:							Optional[int]							=    bytes([ord(_lowerCamelCase	)]	)
              bstring += tok_string
        UpperCAmelCase__			:							int							=    bstring.decode("""utf-8"""							,       errors="""ignore"""	)
        return string




  def  _a      (self							,       _lowerCamelCase							,       _lowerCamelCase = None	):


        """simple docstring"""

        return ()

