





_A :   Union[str, Any]  			=  range(2, 20 + 1)
_A :   Tuple  			=  [10**k for k in range(ks[-1] + 1)]
_A :   dict[int, dict[int, list[list[int]]]]  			=  {}



def 	_a						(   UpperCAmelCase      ,  UpperCAmelCase      ,  UpperCAmelCase      ,  UpperCAmelCase					)    ->    List[Any]:







   """simple docstring"""
   lowerCamelCase__        =							sum(a_i[j] for j in range(UpperCAmelCase      ,  len(UpperCAmelCase					)					)					)
   lowerCamelCase__        =							sum(a_i[j] * base[j] for j in range(min(len(UpperCAmelCase					)      ,  UpperCAmelCase					)					)					)

   lowerCamelCase__        =							0, 0
   lowerCamelCase__        =							n - i

   lowerCamelCase__        =							memo.get(UpperCAmelCase					)

   if sub_memo is not None:
      lowerCamelCase__        =							sub_memo.get(UpperCAmelCase					)

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

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

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

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

   if k > ks[0]:
      while True:
         # keep doing smaller jumps
         lowerCamelCase__        =							next_term(UpperCAmelCase      ,  k - 1      ,  i + dn      ,  UpperCAmelCase					)
         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
      lowerCamelCase__        =							compute(UpperCAmelCase      ,  UpperCAmelCase      ,  i + dn      ,  UpperCAmelCase					)
      diff += _diff
      dn += terms_jumped

   lowerCamelCase__        =							sub_memo[c]

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

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



def 	_a						(   UpperCAmelCase      ,  UpperCAmelCase      ,  UpperCAmelCase      ,  UpperCAmelCase					)    ->    List[Any]:







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

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

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

         ds_c += a_i[j]

      if addend > 0:
         break

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



def 	_a						(   UpperCAmelCase      ,  UpperCAmelCase      ,  UpperCAmelCase					)    ->    List[Any]:







   """simple docstring"""
   for j in range(UpperCAmelCase      ,  len(UpperCAmelCase					)					):
      lowerCamelCase__        =							digits[j] + addend
      if s >= 10:
         lowerCamelCase__        =							divmod(UpperCAmelCase      ,  10					)
         lowerCamelCase__        =							addend // 10 + quotient
      else:
         lowerCamelCase__        =							s
         lowerCamelCase__        =							addend // 10

      if addend == 0:
         break

   while addend > 0:
      lowerCamelCase__        =							divmod(UpperCAmelCase      ,  10					)
      digits.append(UpperCAmelCase					)



def 	_a						(   UpperCAmelCase = 10**15					)    ->    int:







   """simple docstring"""
   lowerCamelCase__        =							[1]
   lowerCamelCase__        =							1
   lowerCamelCase__        =							0
   while True:
      lowerCamelCase__        =							next_term(UpperCAmelCase      ,  20      ,  i + dn      ,  UpperCAmelCase					)
      dn += terms_jumped
      if dn == n - i:
         break

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


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










def 	_a						(   UpperCAmelCase      ,  UpperCAmelCase					)    ->    Dict:







   """simple docstring"""
   if b == 0:
      return 1
   if (b % 2) == 0:
      return actual_power(UpperCAmelCase      ,  int(b / 2					)					) * actual_power(UpperCAmelCase      ,  int(b / 2					)					)
   else:
      return a * actual_power(UpperCAmelCase      ,  int(b / 2					)					) * actual_power(UpperCAmelCase      ,  int(b / 2					)					)



def 	_a						(   UpperCAmelCase      ,  UpperCAmelCase					)    ->    float:







   """simple docstring"""
   if b < 0:
      return 1 / actual_power(UpperCAmelCase      ,  UpperCAmelCase					)
   return actual_power(UpperCAmelCase      ,  UpperCAmelCase					)


if __name__ == "__main__":
       print(power(-2, -3))



