• + 0 comments

    import itertools if name == 'main': x = int(input()) y = int(input()) z = int(input()) n = int(input()) ls = [] ls1 = [] ls2 = [] for i in range (x + 1) : ls .append (i) for i in range (y + 1) : ls1 .append (i) for i in range (z + 1) : ls2 .append (i) result = list(itertools.product(ls , ls1 , ls2)) filtered_result = [list(x) for x in result if sum(x[i] for i in range (len(x))) != n] print(filtered_result)