solutions = list()
m1 = 7
m2 = 11
m3 = 13
miam = 4*131

for i in range(1, 21):
    for j in range(1, 21):
        for k in range(1, 21):
            if i*m1+j*m2+k*m3 == miam:
                solutions.append((i,j,k))    

min_sac = 60
for solution in solutions:
    min_sac = min(solution[0]+solution[1]+solution[2], min_sac)

best = (20, 20, 20)
for solution in solutions:
    if solution[0]+solution[1]+solution[2] == min_sac and solution[2] < best[2]:
        best = solution

print(best, best[0]*m1+best[1]*m2+best[2]*m3, best[0]+best[1]+best[2])
