N = 3 V = [1, 3, 4] def leiaKogus(S): if (S < 0): return 1000000 if (S == 0): return 0 else: vastus = 1000000 for i in range (N): vastus = min(vastus, 1 + leiaKogus(S - V[i])) return vastus print(leiaKogus(6))