





'''simple docstring'''

__lowerCAmelCase							:     List[Any]		     =range(2, 20 + 1)
__lowerCAmelCase							:     Optional[Any]		     =[10**k for k in range(ks[-1] + 1)]
__lowerCAmelCase							:     dict[int, dict[int, list[list[int]]]]		     ={}





def 						UpperCamelCase    (							_lowerCamelCase : Tuple						,	_lowerCamelCase : List[Any]						,	_lowerCamelCase : Tuple						,	_lowerCamelCase : List[str]	):
    A__    =      sum(a_i[j] for j in range(_lowerCamelCase						,	len(_lowerCamelCase	)	)	)
    A__    =      sum(a_i[j] * base[j] for j in range(min(len(_lowerCamelCase	)						,	_lowerCamelCase	)	)	)

    A__,     A__    =      0, 0
    A__    =      n - i

    A__    =      memo.get(_lowerCamelCase	)

    if sub_memo is not None:
        A__    =      sub_memo.get(_lowerCamelCase	)

        if jumps is not None and len(_lowerCamelCase	) > 0:
            # find and make the largest jump without going over
            A__    =      -1
            for _k in range(len(_lowerCamelCase	) - 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(_lowerCamelCase						,	len(_lowerCamelCase	)	)	):
                    A__,     A__    =      divmod(_lowerCamelCase						,	10	)
                if new_c > 0:
                    add(_lowerCamelCase						,	_lowerCamelCase						,	_lowerCamelCase	)

        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(_lowerCamelCase						,	k - 1						,	i + dn						,	_lowerCamelCase	)
            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(_lowerCamelCase						,	_lowerCamelCase						,	i + dn						,	_lowerCamelCase	)
        diff += _diff
        dn += terms_jumped

    A__    =      sub_memo[c]

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

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





def 						UpperCamelCase    (							_lowerCamelCase : Tuple						,	_lowerCamelCase : Tuple						,	_lowerCamelCase : str						,	_lowerCamelCase : Union[str, Any]	):
    if i >= n:
        return 0, i
    if k > len(_lowerCamelCase	):
        a_i.extend([0 for _ in range(k - len(_lowerCamelCase	)	)]	)

    # 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(_lowerCamelCase	)	):
        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(_lowerCamelCase	):
            A__    =      a_i[j] + addend
            A__,     A__    =      divmod(_lowerCamelCase						,	10	)

            ds_c += a_i[j]

        if addend > 0:
            break

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





def 						UpperCamelCase    (							_lowerCamelCase : Optional[int]						,	_lowerCamelCase : Optional[Any]						,	_lowerCamelCase : Dict	):
    for j in range(_lowerCamelCase						,	len(_lowerCamelCase	)	):
        A__    =      digits[j] + addend
        if s >= 10:
            A__,     A__    =      divmod(_lowerCamelCase						,	10	)
            A__    =      addend // 10 + quotient
        else:
            A__    =      s
            A__    =      addend // 10

        if addend == 0:
            break

    while addend > 0:
        A__,     A__    =      divmod(_lowerCamelCase						,	10	)
        digits.append(_lowerCamelCase	)





def 						UpperCamelCase    (							_lowerCamelCase : int = 10**15	):
    A__    =      [1]
    A__    =      1
    A__    =      0
    while True:
        A__,     A__    =      next_term(_lowerCamelCase						,	20						,	i + dn						,	_lowerCamelCase	)
        dn += terms_jumped
        if dn == n - i:
            break

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


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










'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowerCAmelCase							:     Any		     ={
    "configuration_swinv2": ["SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Swinv2Config"],
}


try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __lowerCAmelCase							:     Tuple		     =[
      "SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST",
      "Swinv2ForImageClassification",
      "Swinv2ForMaskedImageModeling",
      "Swinv2Model",
      "Swinv2PreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_swinva import SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP, SwinvaConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_swinva import (
        SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST,
        SwinvaForImageClassification,
        SwinvaForMaskedImageModeling,
        SwinvaModel,
        SwinvaPreTrainedModel,
    )


else:
  import sys

  __lowerCAmelCase							:     List[Any]		     =_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



