#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 3000000000000000 vector<pair<int,int>> get(long long a,long long b){ vector<pair<int,int>> ret; while(true){ if(abs(a)>abs(b)){ ret.emplace_back(2,1); b += a; ret.emplace_back(1,-1); a -= b; continue; } if(a==0){ if(b<0){ ret.emplace_back(1,-1); a -= b; ret.emplace_back(2,1); b += a; continue; } else{ return ret; } } long long d = abs(b) / abs(a); if(abs(b) < abs(b+a*d)){ d *= -1; } ret.emplace_back(2,d); b += a * d; } } int main(){ long long a,b,c,d; cin>>a>>b>>c>>d; if(gcd(abs(a),abs(b))!=gcd(abs(c),abs(d))){ cout<<-1<<endl; return 0; } auto ans = get(a,b); auto t = get(c,d); reverse(t.begin(),t.end()); rep(i,t.size()){ ans.emplace_back(t[i].first,t[i].second*-1); } cout<<ans.size()<<endl; rep(i,ans.size()){ cout<<ans[i].first<<' '<<ans[i].second<<endl; if(ans[i].first==1){ a += b * ans[i].second; } else{ b += a * ans[i].second; } } //cout<<a<<','<<b<<endl; return 0; }