#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; vector > e; if (a == c and b == c) { repeat (i,c) e.emplace_back(i, (i+1)%c); } else if (a == 1) { repeat (i,b-1) e.emplace_back(i+1, i+2); } else if (b == 1) { repeat (i,a-1) e.emplace_back(i == 0 ? 0 : i+1, i+2); } else { throw 0; int A = 1000000; int B = 2000000; int C = 3000000; map tr; 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 (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; }