def count(n, coins, max_taken):
    if n==0:return 1
    # print(max_taken)
    global store
    if (n,max_taken) in store:
        return store[(n,max_taken)]
    ans = 0
    for coin in coins:
        if coin <= n and coin <= max_taken:
            # ans += n//coin
            ans += count(n - coin, coins, coin)
    store[(n,max_taken)] = ans
    return ans
store = {}
coins = [5,2,1]

print(count(136,coins,5))
c0790961ffda2ba85b3c5c639f71af377818cf7d
<mask token>

def count(n, coins, max_taken):
    if n == 0:
        return 1
    global store
    if (n, max_taken) in store:
        return store[n, max_taken]
    ans = 0
    for coin in coins:
        if coin <= n and coin <= max_taken:
            ans += count(n - coin, coins, coin)
    store[n, max_taken] = ans
    return ans


<mask token>

def count(n, coins, max_taken):
    if n == 0:
        return 1
    global store
    if (n, max_taken) in store:
        return store[n, max_taken]
    ans = 0
    for coin in coins:
        if coin <= n and coin <= max_taken:
            ans += count(n - coin, coins, coin)
    store[n, max_taken] = ans
    return ans


<mask token>
print(count(136, coins, 5))

def count(n, coins, max_taken):
    if n == 0:
        return 1
    global store
    if (n, max_taken) in store:
        return store[n, max_taken]
    ans = 0
    for coin in coins:
        if coin <= n and coin <= max_taken:
            ans += count(n - coin, coins, coin)
    store[n, max_taken] = ans
    return ans


store = {}
coins = [5, 2, 1]
print(count(136, coins, 5))

def count(n, coins, max_taken):
    if n==0:return 1
    # print(max_taken)
    global store
    if (n,max_taken) in store:
        return store[(n,max_taken)]
    ans = 0
    for coin in coins:
        if coin <= n and coin <= max_taken:
            # ans += n//coin
            ans += count(n - coin, coins, coin)
    store[(n,max_taken)] = ans
    return ans
store = {}
coins = [5,2,1]

print(count(136,coins,5))