from itertools import product
all_digits = set(range(10))
sums = '26058349'
sums = set(map(int, sums))
combinations = {0: [], 1: []}
for first in all_digits:
for second in all_digits:
for third in all_digits:
for fourth in all_digits:
combo = (first, second, third, fourth)
if (second + third) % 10 in sums:
combinations[1].append("".join(map(str, combo)))
else:
combinations[0].append("".join(map(str, combo)))
for value, combo_list in combinations.items():
print(f"Value {value}:")
print(" ".join(combo_list))
print()