




"""simple docstring"""

a					=			range(2, 20 + 1)
a					=			[10**k for k in range(ks[-1] + 1)]
a					=			{}






def 						_snake_case     (					_snake_case							:					Dict				,  _snake_case							:					List[str]				,  _snake_case							:					Dict				,  _snake_case							:					int							)    ->					Any:






      '''simple docstring'''


      _A					   =   sum(a_i[j] for j in range(__A				,  len(__A							)							)							)
      _A					   =   sum(a_i[j] * base[j] for j in range(min(len(__A							)				,  __A							)							)							)

      _A   ,    _A					   =   0, 0
      _A					   =   n - i

      _A					   =   memo.get(__A							)

      if sub_memo is not None:
            _A					   =   sub_memo.get(__A							)

            if jumps is not None and len(__A							) > 0:
                  # find and make the largest jump without going over
                  _A					   =   -1
                  for _k in range(len(__A							) - 1				,  -1				,  -1							):
                        if jumps[_k][2] <= k and jumps[_k][1] <= max_dn:
                              _A					   =   _k
                              break

                  if max_jump >= 0:
                        _A   ,    _A   ,    _A					   =   jumps[max_jump]
                        # since the difference between jumps is cached, add c
                        _A					   =   diff + c
                        for j in range(min(__A				,  len(__A							)							)							):
                              _A   ,    _A					   =   divmod(__A				,  10							)
                        if new_c > 0:
                              add(__A				,  __A				,  __A							)

            else:
                  _A					   =   []
      else:
            _A					   =   {c: []}
            _A					   =   sub_memo

      if dn >= max_dn or c + diff >= base[k]:
            return diff, dn

      if k > ks[0]:
            while True:
                  # keep doing smaller jumps
                  _A   ,    _A					   =   next_term(__A				,  k - 1				,  i + dn				,  __A							)
                  diff += _diff
                  dn += terms_jumped

                  if dn >= max_dn or c + diff >= base[k]:
                        break
      else:
            # would be too small a jump, just compute sequential terms instead
            _A   ,    _A					   =   compute(__A				,  __A				,  i + dn				,  __A							)
            diff += _diff
            dn += terms_jumped

      _A					   =   sub_memo[c]

      # keep jumps sorted by # of terms skipped
      _A					   =   0
      while j < len(__A							):
            if jumps[j][1] > dn:
                  break
            j += 1

      # cache the jump for this value digitsum(b) and c
      sub_memo[c].insert(__A				,  (diff, dn, k)							)
      return (diff, dn)






def 						_snake_case     (					_snake_case							:					Optional[int]				,  _snake_case							:					Dict				,  _snake_case							:					Dict				,  _snake_case							:					Tuple							)    ->					List[Any]:






      '''simple docstring'''


      if i >= n:
            return 0, i
      if k > len(__A							):
            a_i.extend([0 for _ in range(k - len(__A							)							)]							)

      # note: a_i -> b * 10^k + c
      # ds_b -> digitsum(b)
      # ds_c -> digitsum(c)
      _A					   =   i
      _A   ,    _A   ,    _A					   =   0, 0, 0
      for j in range(len(__A							)							):
            if j >= k:
                  ds_b += a_i[j]
            else:
                  ds_c += a_i[j]

      while i < n:
            i += 1
            _A					   =   ds_c + ds_b
            diff += addend
            _A					   =   0
            for j in range(__A							):
                  _A					   =   a_i[j] + addend
                  _A   ,    _A					   =   divmod(__A				,  10							)

                  ds_c += a_i[j]

            if addend > 0:
                  break

      if addend > 0:
            add(__A				,  __A				,  __A							)
      return diff, i - start_i






def 						_snake_case     (					_snake_case							:					Any				,  _snake_case							:					Union[str, Any]				,  _snake_case							:					List[str]							)    ->					Tuple:






      '''simple docstring'''


      for j in range(__A				,  len(__A							)							):
            _A					   =   digits[j] + addend
            if s >= 10:
                  _A   ,    _A					   =   divmod(__A				,  10							)
                  _A					   =   addend // 10 + quotient
            else:
                  _A					   =   s
                  _A					   =   addend // 10

            if addend == 0:
                  break

      while addend > 0:
            _A   ,    _A					   =   divmod(__A				,  10							)
            digits.append(__A							)






def 						_snake_case     (					_snake_case							:					Any = 10**15							)    ->					int:






      '''simple docstring'''


      _A					   =   [1]
      _A					   =   1
      _A					   =   0
      while True:
            _A   ,    _A					   =   next_term(__A				,  20				,  i + dn				,  __A							)
            dn += terms_jumped
            if dn == n - i:
                  break

      _A					   =   0
      for j in range(len(__A							)							):
            a_n += digits[j] * 10**j
      return a_n


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



'''simple docstring'''







from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow


if is_tf_available():
					import numpy as np
					import tensorflow as tf

					from transformers import TFCamembertModel


@require_tf
@require_sentencepiece
@require_tokenizers
class 						__UpperCAmelCase      (					unittest.TestCase						):


							@slow
							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		TFCamembertModel.from_pretrained('jplu/tf-camembert-base'  )

								_snake_case   						=		tf.convert_to_tensor(
								    [[5, 1_21, 11, 6_60, 16, 7_30, 2_55_43, 1_10, 83, 6]]    ,   dtype=tf.intaa    ,   )  # J'aime le camembert !"

								_snake_case   						=		model(lowerCAmelCase_  )['last_hidden_state']
								_snake_case   						=		tf.TensorShape((1, 10, 7_68)  )
								self.assertEqual(output.shape    ,   lowerCAmelCase_  )
								# compare the actual values for a slice.
								_snake_case   						=		tf.convert_to_tensor(
								    [[[-0.0254, 0.0235, 0.1027], [0.0606, -0.1811, -0.0418], [-0.1561, -0.1127, 0.2687]]]    ,   dtype=tf.floataa    ,   )
								# camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')
								# camembert.eval()
								# expected_slice = roberta.model.forward(input_ids)[0][:, :3, :3].detach()

								self.assertTrue(np.allclose(output[:, :3, :3].numpy()    ,   expected_slice.numpy()    ,   atol=1E-4  )  )

