a,b,c,d = map(int,input().split()) c,d,a,b = a,b,c,d from math import gcd if gcd(a,b) != gcd(c,d): print(-1) exit() cd = [[c,d]] if c < 0: c = c + abs(d) * (10**8+10) cd.append([c,d]) if d < 0: d = d + (abs(d)//c+1)*c cd.append([c,d]) while c != 0 and d != 0: if c < d: d %= c cd.append([c,d]) else: c %= d cd.append([c,d]) ab = [[a,b]] if a < 0: a = a + abs(b) * (10**8+10) ab.append([a,b]) if b < 0: b = b + (abs(b)//a+1)*a ab.append([a,b]) while a != 0 and b != 0: if a < b: b %= a ab.append([a,b]) else: a %= b ab.append([a,b]) if ab[-1] == cd[-1]: ab.pop() cd += ab[::-1] else: ab.append([max(ab[-1]), max(ab[-1])]) cd += ab[::-1] print(len(cd)-1) for i in range(1,len(cd)): c,d = cd[i] if c == cd[i-1][0]: dd = cd[i-1][1] tmp = (d - dd)//c print(2, tmp) else: cc = cd[i-1][0] tmp = (c-cc)//d print(1, tmp)