


'''simple docstring'''

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





def __snake_case      (   UpperCAmelCase_		:		Any      ,       UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		Union[str, Any]      ,       UpperCAmelCase_		:		Optional[int]	):
 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_				,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_				,lowerCamelCase_				,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_				,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_				,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_				,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 __snake_case      (   UpperCAmelCase_		:		Dict      ,       UpperCAmelCase_		:		Tuple      ,       UpperCAmelCase_		:		Any      ,       UpperCAmelCase_		:		List[str]	):
 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_				,lowerCamelCase_				,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_				,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 __snake_case      (   UpperCAmelCase_		:		List[Any]      ,       UpperCAmelCase_		:		str      ,       UpperCAmelCase_		:		Dict	):
 for j in range(UpperCAmelCase_      ,       len(UpperCAmelCase_	)	):
  lowerCamelCase_  				=						digits[j] + addend
  if s >= 10:
   lowerCamelCase_				,lowerCamelCase_  				=						divmod(UpperCAmelCase_      ,       10	)
   lowerCamelCase_  				=						addend // 10 + quotient
  else:
   lowerCamelCase_  				=						s
   lowerCamelCase_  				=						addend // 10

  if addend == 0:
   break

 while addend > 0:
  lowerCamelCase_				,lowerCamelCase_  				=						divmod(UpperCAmelCase_      ,       10	)
  digits.append(UpperCAmelCase_	)





def __snake_case      (   UpperCAmelCase_		:		int = 10**15	):
 lowerCamelCase_  				=						[1]
 lowerCamelCase_  				=						1
 lowerCamelCase_  				=						0
 while True:
  lowerCamelCase_				,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() = }''')







'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


a_						:       List[Any]      			=				{
    """configuration_owlvit""": [
        """OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """OwlViTConfig""",
        """OwlViTOnnxConfig""",
        """OwlViTTextConfig""",
        """OwlViTVisionConfig""",
    ],
    """processing_owlvit""": ["""OwlViTProcessor"""],
}


try:
     if not is_vision_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     a_						:       int      			=				["""OwlViTFeatureExtractor"""]
     a_						:       Any      			=				["""OwlViTImageProcessor"""]

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     a_						:       Tuple      			=				[
         """OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """OwlViTModel""",
         """OwlViTPreTrainedModel""",
         """OwlViTTextModel""",
         """OwlViTVisionModel""",
         """OwlViTForObjectDetection""",
     ]

if TYPE_CHECKING:
     from .configuration_owlvit import (
         OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
         OwlViTConfig,
         OwlViTOnnxConfig,
         OwlViTTextConfig,
         OwlViTVisionConfig,
     )
     from .processing_owlvit import OwlViTProcessor

     try:
          if not is_vision_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .feature_extraction_owlvit import OwlViTFeatureExtractor
          from .image_processing_owlvit import OwlViTImageProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_owlvit import (
              OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
              OwlViTForObjectDetection,
              OwlViTModel,
              OwlViTPreTrainedModel,
              OwlViTTextModel,
              OwlViTVisionModel,
          )

else:
     import sys

     a_						:       Tuple      			=				_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



