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() if a == c and b == d: print(0) exit() cd = [[c,d]] ab = [[a,b]] if c == 0: cd.append([c+d, d]) c,d = cd[-1] if d == 0: cd.append([c, c+d]) c,d = cd[-1] if a == 0: ab.append([a+b,b]) a,b = ab[-1] if b == 0: ab.append([a, a+b]) a,b = ab[-1] if c < 0: c = c + (abs(c)//abs(d)+1)*abs(d) 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]) if a < 0: a = a + (abs(a)//abs(b)+1)*abs(b) 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)