#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll a, b, c, d, mn; cin >> a >> b >> c >> d; mn = min(a == 0 ? 1ll << 30 : abs(a), b == 0 ? 1ll << 30 : abs(b)); vector> ope1, ope2, ope; function(ll,ll)> f = [&](ll x, ll y){ if(abs(y) == 0){ if(x < 0){ ope.emplace_back(2, -1); ope.emplace_back(1, 1); return f(0, -x); } return make_pair(x, y); } if(abs(x) == 0){ if(y > 0){ ope.emplace_back(1, 1); ope.emplace_back(2, -1); return f(y, 0); }else{ ope.emplace_back(1, -1); ope.emplace_back(2, 1); return f(-y, 0); } } if(abs(x) > abs(y)){ ll d = x / y; ope.emplace_back(1, -d); return f(x - d * y, y); } ll d = y / x; ope.emplace_back(2, -d); return f(x, y - d * x); }; auto p1 = f(a, b); ope1 = ope; ope.clear(); auto p2 = f(c, d); ope2 = ope; //cerr << p1.first << " " << p1.second << '\n'; //cerr << p2.first << " " << p2.second << '\n'; if(p1 != p2){ cout << -1 << '\n'; return 0; } reverse(ope2.begin(), ope2.end()); for(auto &&p:ope2)p.second *= -1; ope1.insert(ope1.end(), ope2.begin(), ope2.end()); cout << ope1.size() << '\n'; for(int i = 0; i < ope1.size(); i++){ //cerr << a << " " << b << '\n'; if(ope1[i].first == 1){ a += ope1[i].second * b; }else{ b += ope1[i].second * a; } cout << ope1[i].first << " " << ope1[i].second << '\n'; } //cerr << a << " " << b << '\n'; //cerr << a << " " << b << '\n'; //cerr << c << " " << d << '\n'; }