def construct_liste(V):
    L = [0]*(V+1)
    return nombre_top_down(V, L)

def nombre_top_down(value, L, S = [1,7,9]):
    if V == 0:
        return 0
    elif L[V] > 0:
        return L[V]
    else:
        minimum = V + 1
        for piece in S:
            if piece <= V:
                n = 1 + nombre_top_down(V - piece, L)
                if n < minimum:
                    minimum = n
                    L[V] = minimum
        return minimum

print(ConstructListe(14))