#include #include #include #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i)) using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; bool impossible = false; vector > e; if (a == c and b == c) { if (c == 1) impossible = true; repeat (i,c) e.emplace_back(i, (i+1)%c); } else { int A = 1000000; int B = 2000000; int C = 3000000; map tr; if (c == 0) { repeat (i,a-1) e.emplace_back(A+i, A+i+1); repeat (i,b-1) e.emplace_back(B+i, B+i+1); } else { repeat (i,a-c) e.emplace_back(A+i, A+i+1); repeat (i,b-c) e.emplace_back(B+i, B+i+1); repeat (i,c-1) e.emplace_back(C+i, C+i+1); if (a == c) A = C; if (b == c) B = C; tr[A+a-c] = C; tr[B+b-c] = C; } map compress; compress[A] = 0; compress[B] = 1; auto name = [&](int & i) { if (tr.count(i)) i = tr[i]; if (not compress.count(i)) { int size = compress.size(); compress[i] = size; } i = compress[i]; }; for (auto & it : e) { name(it.first); name(it.second); } } if (impossible or e.size() > d) { cout << -1 << endl; } else { cout << a+b-c << ' ' << e.size() << endl; for (auto it : e) cout << it.first << ' ' << it.second << endl; } return 0; }