






'''simple docstring'''






__A    	=   range(2, 2_0 + 1)
__A    	=   [1_0**k for k in range(ks[-1] + 1)]
__A    	=   {}




def        _SCREAMING_SNAKE_CASE  (				A  :       Optional[Any]  ,		A  :       List[str]  ,		A  :       Union[str, Any]  ,		A  :       Any  )    -> List[Any]:







   """simple docstring"""
   __snake_case				:      Any     							= sum(a_i[j] for j in range(A  ,		len(A  )  )  )
   __snake_case				:      List[str]     							= sum(a_i[j] * base[j] for j in range(min(len(A  )  ,		A  )  )  )

   __snake_case							,__snake_case				:      int     							= 0, 0
   __snake_case				:      List[Any]     							= n - i

   __snake_case				:      Optional[int]     							= memo.get(A  )

   if sub_memo is not None:
      __snake_case				:      List[str]     							= sub_memo.get(A  )

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

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

      else:
         __snake_case				:      Optional[int]     							= []
   else:
      __snake_case				:      List[Any]     							= {c: []}
      __snake_case				:      Tuple     							= sub_memo

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

   if k > ks[0]:
      while True:
         # keep doing smaller jumps
         __snake_case							,__snake_case				:      Optional[int]     							= 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
      __snake_case							,__snake_case				:      Union[str, Any]     							= compute(A  ,		A  ,		i + dn  ,		A  )
      diff += _diff
      dn += terms_jumped

   __snake_case				:      int     							= sub_memo[c]

   # keep jumps sorted by # of terms skipped
   __snake_case				:      Union[str, Any]     							= 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        _SCREAMING_SNAKE_CASE  (				A  :       List[Any]  ,		A  :       Dict  ,		A  :       Tuple  ,		A  :       int  )    -> 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)
   __snake_case				:      Tuple     							= i
   __snake_case							,__snake_case							,__snake_case				:      Optional[int]     							= 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
      __snake_case				:      Tuple     							= ds_c + ds_b
      diff += addend
      __snake_case				:      int     							= 0
      for j in range(A  ):
         __snake_case				:      Tuple     							= a_i[j] + addend
         __snake_case							,__snake_case				:      Union[str, Any]     							= 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        _SCREAMING_SNAKE_CASE  (				A  :       Tuple  ,		A  :       Union[str, Any]  ,		A  :       Dict  )    -> Tuple:







   """simple docstring"""
   for j in range(A  ,		len(A  )  ):
      __snake_case				:      Any     							= digits[j] + addend
      if s >= 10:
         __snake_case							,__snake_case				:      Tuple     							= divmod(A  ,		10  )
         __snake_case				:      Tuple     							= addend // 10 + quotient
      else:
         __snake_case				:      Dict     							= s
         __snake_case				:      List[str]     							= addend // 10

      if addend == 0:
         break

   while addend > 0:
      __snake_case							,__snake_case				:      Optional[int]     							= divmod(A  ,		10  )
      digits.append(A  )




def        _SCREAMING_SNAKE_CASE  (				A  :       int = 10**15  )    -> int:







   """simple docstring"""
   __snake_case				:      Optional[int]     							= [1]
   __snake_case				:      List[str]     							= 1
   __snake_case				:      Tuple     							= 0
   while True:
      __snake_case							,__snake_case				:      Tuple     							= next_term(A  ,		20  ,		i + dn  ,		A  )
      dn += terms_jumped
      if dn == n - i:
         break

   __snake_case				:      Union[str, Any]     							= 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 ...configuration_utils import PretrainedConfig
from ...utils import logging


__A    	=   logging.get_logger(__name__)

__A    	=   {
    '''sayakpaul/vit-msn-base''': '''https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json''',
    # See all ViT MSN models at https://huggingface.co/models?filter=vit_msn
}




class a_    (    UpperCamelCase_							):
   _snake_case        =							"""vit_msn"""







   def __init__(self					,   __a=7_6_8					,   __a=1_2					,   __a=1_2					,   __a=3_0_7_2					,   __a="gelu"					,   __a=0.0					,   __a=0.0					,   __a=0.02					,   __a=1E-06					,   __a=2_2_4					,   __a=1_6					,   __a=3					,   __a=True					,   **__a					,   )			->      Any:
      """simple docstring"""






      super().__init__(**__a)

      __snake_case				:      List[str]     							= hidden_size
      __snake_case				:      Optional[int]     							= num_hidden_layers
      __snake_case				:      Optional[Any]     							= num_attention_heads
      __snake_case				:      str     							= intermediate_size
      __snake_case				:      List[str]     							= hidden_act
      __snake_case				:      List[Any]     							= hidden_dropout_prob
      __snake_case				:      Tuple     							= attention_probs_dropout_prob
      __snake_case				:      List[str]     							= initializer_range
      __snake_case				:      Optional[int]     							= layer_norm_eps
      __snake_case				:      Dict     							= image_size
      __snake_case				:      int     							= patch_size
      __snake_case				:      Dict     							= num_channels
      __snake_case				:      Tuple     							= qkv_bias