a,b,c,d = 133,125,134,111 test = [] for i in range(10000,99999): if i % a == b and i % c == d: test += [i] print(test if test else -1)