def NombreBottomUp(V):
    S = [1,7,9]
    L = [0]*(V+1)
    valeurs = [0]*(V+1)
    for x in range(1,V+1):
        minimum = V + 1
        for i in range(len(S)):
            if (S[i] <= x) and (1+L[x-S[i]] < minimum):
                minimum = 1 + L[ x - S[i] ]
                v = i
        L[x] = minimum
        valeurs[x] = v  
    x, R = V, [ ]
    while x > 0:
        R.append(S[ valeurs[x] ])
        x -= S[ valeurs[x] ]
        
    return L[V], R

print(NombreBottomUp(14))
