





def 							__snake_case							(    lowerCAmelCase_	)				->						int:
    SCREAMING_SNAKE_CASE__											=			0
    while num > 0:
        digit_sum += num % 1_0
        num //= 1_0
    return digit_sum


def 							__snake_case							(    lowerCAmelCase_ = 1_0_0	)				->						int:
    SCREAMING_SNAKE_CASE__											=			1
    SCREAMING_SNAKE_CASE__											=			2

    for i in range(2 ,							max_n + 1	):
        SCREAMING_SNAKE_CASE__											=			pre_numerator
        SCREAMING_SNAKE_CASE__											=			2 * i // 3 if i % 3 == 0 else 1
        SCREAMING_SNAKE_CASE__											=			cur_numerator
        SCREAMING_SNAKE_CASE__											=			e_cont * pre_numerator + temp

    return sum_digits(lowerCAmelCase_	)


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







import os
import unittest

from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer
from transformers.testing_utils import get_tests_dir

from ...test_tokenization_common import TokenizerTesterMixin


_A					:				Dict				=			get_tests_dir("""fixtures/test_sentencepiece_bpe.model""")



class 					__snake_case	(  __SCREAMING_SNAKE_CASE			,     unittest.TestCase    ):


    '''simple docstring'''







    lowerCamelCase__    :		Any				=	BartphoTokenizer
    lowerCamelCase__    :		Tuple				=	False
    lowerCamelCase__    :		Dict				=	True



    def  lowercase_					(       self     ):





        '''simple docstring'''

        super().setUp()

        SCREAMING_SNAKE_CASE__											=			['''▁This''', '''▁is''', '''▁a''', '''▁t''', '''est''']
        SCREAMING_SNAKE_CASE__											=			dict(zip(A_   ,				range(len(A_     )     )     )     )
        SCREAMING_SNAKE_CASE__											=			{'''unk_token''': '''<unk>'''}

        SCREAMING_SNAKE_CASE__											=			os.path.join(self.tmpdirname   ,				VOCAB_FILES_NAMES['''monolingual_vocab_file''']     )
        with open(self.monolingual_vocab_file   ,				'''w'''   ,				encoding='''utf-8'''     ) as fp:
            for token in vocab_tokens:
                fp.write(f'''{token} {vocab_tokens[token]}\n'''     )

        SCREAMING_SNAKE_CASE__											=			BartphoTokenizer(A_   ,				self.monolingual_vocab_file   ,				**self.special_tokens_map     )
        tokenizer.save_pretrained(self.tmpdirname     )



    def  lowercase_					(       self   ,				**A_     ):





        '''simple docstring'''

        kwargs.update(self.special_tokens_map     )
        return BartphoTokenizer.from_pretrained(self.tmpdirname   ,				**A_     )



    def  lowercase_					(       self   ,				A_     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			'''This is a là test'''
        SCREAMING_SNAKE_CASE__											=			'''This is a<unk><unk> test'''
        return input_text, output_text




    def  lowercase_					(       self     ):





        '''simple docstring'''

        SCREAMING_SNAKE_CASE__											=			BartphoTokenizer(A_   ,				self.monolingual_vocab_file   ,				**self.special_tokens_map     )
        SCREAMING_SNAKE_CASE__											=			'''This is a là test'''
        SCREAMING_SNAKE_CASE__											=			'''▁This ▁is ▁a ▁l à ▁t est'''.split()
        SCREAMING_SNAKE_CASE__											=			tokenizer.tokenize(A_     )
        self.assertListEqual(A_   ,				A_     )

        SCREAMING_SNAKE_CASE__											=			tokens + [tokenizer.unk_token]
        SCREAMING_SNAKE_CASE__											=			[4, 5, 6, 3, 3, 7, 8, 3]
        self.assertListEqual(tokenizer.convert_tokens_to_ids(A_     )   ,				A_     )
