#int(input()) #map(int, input().split()) #list(map(int, input().split())) a, b, c, d = map(int, input().split()) from math import gcd ga = gcd(abs(a), abs(b)) gc = gcd(abs(c), abs(d)) if ga != gc: print("-1") exit() if a == c and b == d: print(0) exit() a //= ga b //= ga c //= ga d //= ga ans = [] if b <= 0: if a == 0: ans.append((1, -1)) a -= b if a > 0: k = b // a ans.append((2, -k+1)) b += (-k+1) * a else: k = b // -a ans.append((2, k-1)) b += (k-1) * a if a < 0: k = a // b ans.append((1, -k+1)) a += (-k+1) * b while a != 1 or b != 1: if a == 1: ans.append((2, -b+1)) b = 1 elif b == 1: ans.append((1, -a+1)) a = 1 elif a >= b: u, v = divmod(a, b) ans.append((1, -u)) a += -u * b else: u, v = divmod(b, a) ans.append((2, -u)) b += -u * a ans1 = [] if d <= 0: if c == 0: ans1.append((1, -1)) c -= d if c > 0: k = d // c ans1.append((2, -k+1)) d += (-k+1) * c else: k = d // -c ans1.append((2, k-1)) d += (k-1) * c if c < 0: k = c // d ans1.append((1, -k+1)) c += (-k+1) * d # print(c, d) while c != 1 or d != 1: if c == 1: ans1.append((2, -d+1)) d = 1 elif d == 1: ans1.append((1, -c+1)) c = 1 elif c >= d: u, v = divmod(c, d) ans1.append((1, -u)) c += -u * d else: u, v = divmod(d, c) ans1.append((2, -u)) d += -u * c # print(a, b, c, d) # print(ans) # print(ans1) print(len(ans) + len(ans1)) for i in range(len(ans)): u, v = ans[i] print(u, v) for i in range(len(ans1)): u, v = ans1[-i-1] print(u, -v)