#include std::vector> go(int x, int y) { std::vector> ret; auto op = [&](int t, int k) { ret.emplace_back(t, k); if (t == 1) { x += k * y; } else { y += k * x; } }; while (true) { if (x && y) { if (std::abs(x) < std::abs(y)) { op(2, -y / x); } else { op(1, -x / y); } } else { if (x) { op(2, 1); op(1, -1); } assert(x == 0); if (y < 0) { op(1, -1); op(2, 2); op(1, -1); } assert(x == 0 && 0 <= y); break; } } return ret; } void solve(std::istream& is, std::ostream& os) { int a, b, c, d; is >> a >> b >> c >> d; if (std::gcd(a, b) != std::gcd(c, d)) { os << "-1\n"; return; } auto op1 = go(a, b); auto op2 = go(c, d); os << op1.size() + op2.size() << '\n'; for (auto [t, k] : op1) { os << t << ' ' << k << '\n'; } std::reverse(op2.begin(), op2.end()); for (auto [t, k] : op2) { os << t << ' ' << -k << '\n'; } } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); solve(std::cin, std::cout); }