def count_money_iter(total, cash, count):
    if not len(cash):
        count[0] += 1
    else:
        for x in range(total // cash[0] + 1):
            count_money_iter(total - x * cash[0], cash[1:], count)

def count_money(total, cash):
    count = [0]
    count_money_iter(total, cash, count)
    return count[0]

print(count_money(200, [200, 100, 50, 20, 10, 5, 2]))