#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(c) begin(c), end(c) #define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl int g[2010][2010]; bool solve(int a, int b, int c, int m){ int n = a + b + c; rep(i, n) rep(j, n) g[i][j] = false; int k = 2; vector as, bs, cs; rep(i, a - 1) as.push_back(k++); rep(i, b - 1) bs.push_back(k++); if(!c){ if(!a || !b) return false; as.push_back(0); bs.push_back(1); } else { if(a) as.push_back(0); else cs.push_back(0); if(b) bs.push_back(1); else cs.push_back(1); rep(i, c - !a - !b) cs.push_back(k++); } sort(all(as)); sort(all(bs)); sort(all(cs)); dump(a); dump(b); dump(c); // for(auto &e : as) cout << e << ' '; // cout << endl; // for(auto &e : bs) cout << e << ' '; // cout << endl; // for(auto &e : cs) cout << e << ' '; // cout << endl; assert(k == n); rep(i, a - 1) g[as[i]][as[i+1]] = true, --m; rep(i, b - 1) g[bs[i]][bs[i+1]] = true, --m; rep(i, c - 1) g[cs[i]][cs[i+1]] = true, --m; if(a && c) g[as[0]][cs[0]] = true, --m; if(b && c) g[bs[0]][cs[0]] = true, --m; if(m < 0) return false; // auto fill_v = [&](const vector &vs){ // rep(i, vs.size()) rep(j, i){ // if(m && !g[vs[i]][vs[j]]) g[vs[i]][vs[j]] = true, --m; // } // }; // auto fill_vw = [&](const vector &vs, const vector &ws){ // rep(i, vs.size()) rep(j, ws.size()){ // if(m && !g[vs[i]][ws[j]]) g[vs[i]][ws[j]] = true, --m; // } // }; // fill_v(as); // fill_v(bs); // fill_v(cs); // fill_vw(as, cs); // fill_vw(bs, cs); return true; } int main(){ int A, B, C, D; while(cin >> A >> B >> C >> D){ int a = A - C; int b = B - C; if(solve(a, b, C, D)){ int n = a + b + C; int m = 0; rep(i,n) rep(j,n) if(g[i][j]) ++m; cout << n << ' ' << m << '\n'; rep(i,n) rep(j,n) if(g[i][j]) cout << i << ' ' << j << '\n'; } else puts("-1"); } }