"""simple docstring"""


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







def 					UpperCAmelCase    (		UpperCAmelCase						,					UpperCAmelCase						,					UpperCAmelCase						,					UpperCAmelCase					)				->      Optional[int]:
     snake_case_					       =					sum(a_i[j] for j in range(UpperCAmelCase						,					len(UpperCAmelCase					)					)					)
     snake_case_					       =					sum(a_i[j] * base[j] for j in range(min(len(UpperCAmelCase					)						,					UpperCAmelCase					)					)					)

     snake_case_       ,	snake_case_					       =					0, 0
     snake_case_					       =					n - i

     snake_case_					       =					memo.get(UpperCAmelCase					)

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

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

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

          else:
               snake_case_					       =					[]
     else:
          snake_case_					       =					{c: []}
          snake_case_					       =					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_					       =					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
          snake_case_       ,	snake_case_					       =					compute(UpperCAmelCase						,					UpperCAmelCase						,					i + dn						,					UpperCAmelCase					)
          diff += _diff
          dn += terms_jumped

     snake_case_					       =					sub_memo[c]

     # keep jumps sorted by # of terms skipped
     snake_case_					       =					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 					UpperCAmelCase    (		UpperCAmelCase						,					UpperCAmelCase						,					UpperCAmelCase						,					UpperCAmelCase					)				->      Optional[Any]:
     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)
     snake_case_					       =					i
     snake_case_       ,	snake_case_       ,	snake_case_					       =					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
          snake_case_					       =					ds_c + ds_b
          diff += addend
          snake_case_					       =					0
          for j in range(UpperCAmelCase					):
               snake_case_					       =					a_i[j] + addend
               snake_case_       ,	snake_case_					       =					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 					UpperCAmelCase    (		UpperCAmelCase						,					UpperCAmelCase						,					UpperCAmelCase					)				->      Union[str, Any]:
     for j in range(UpperCAmelCase						,					len(UpperCAmelCase					)					):
          snake_case_					       =					digits[j] + addend
          if s >= 10:
               snake_case_       ,	snake_case_					       =					divmod(UpperCAmelCase						,					10					)
               snake_case_					       =					addend // 10 + quotient
          else:
               snake_case_					       =					s
               snake_case_					       =					addend // 10

          if addend == 0:
               break

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







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

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


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






'''simple docstring'''





def lowerCAmelCase  (__A  ,	__A):



     """simple docstring"""



     _a      =  int(__A)

     # Initialize Result
     _a      =  []

     # Traverse through all denomination
     for denomination in reversed(__A):
          # Find denominations
          while int(__A) >= int(__A):
               total_value -= int(__A)
               answer.append(__A)  # Append the "answers" array

     return answer


# Driver Code
if __name__ == "__main__":
  lowercase_		       =  []
  lowercase_		       =  "0"

  if (
      input("Do you want to enter your denominations ? (yY/n): ").strip().lower()
      == "y"
  ):
    lowercase_		       =  int(input("Enter the number of denominations you want to add: ").strip())

    for i in range(0, n):
      denominations.append(int(input(F"""Denomination {i}: """).strip()))
    lowercase_		       =  input("Enter the change you want to make in Indian Currency: ").strip()
  else:
    # All denominations of Indian Currency if user does not enter
    lowercase_		       =  [1, 2, 5, 10, 20, 50, 100, 500, 2_000]
    lowercase_		       =  input("Enter the change you want to make: ").strip()

  if int(value) == 0 or int(value) < 0:
    print("The total value cannot be zero or negative.")

  else:
    print(F"""Following is minimal change for {value}: """)
    lowercase_		       =  find_minimum_change(denominations, value)
    # Print result
    for i in range(len(answer)):
      print(answer[i], end=" ")



