from itertools import*
f=lambda d,t,l:set(tuple(sorted(i+d))for i in product(d,repeat=l-len(d))if sum(i+d)==t)

print(f((1,2,3),36,15))