#include using namespace std; #define F first #define S second #define pi M_PI #define R cin>> #define Z class #define ll long long #define ln cout<<'\n' #define in(a) insert(a) #define pb(a) push_back(a) #define pd(a) printf("%.10f\n",a) #define mem(a) memset(a,0,sizeof(a)) #define all(c) (c).begin(),(c).end() #define iter(c) __typeof((c).begin()) #define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--) #define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++) #define rep(i,n) REP(i,0,n) #define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++) templatevoid pr(A a){cout<void pr(A a,B b){cout<void pr(A a,B b,C c){cout<void pr(A a,B b,C c,D d){cout<void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<=0&&x=0&&y P; void Main() { int a[4]; rep(i,4) R a[i]; if(!a[0]||!a[1]||a[0] v,v2,v3; vector

ans; v.pb(0);v2.pb(1); int k=2; if(x&&y) { rep(i,x-1) v.pb(k++); rep(i,y-1) v2.pb(k++); } else if(x) { rep(i,x-1) v.pb(k++); v.pb(1); } else if(y) { rep(i,y-1) v2.pb(k++); v2.pb(0); } rep(i,a[2]-(!x||!y)) v3.pb(k++); rep(i,v.size()-1) ans.pb(P(v[i],v[i+1])); rep(i,v2.size()-1) ans.pb(P(v2[i],v2[i+1])); if(v3.size()) { if(x) ans.pb(P(v[v.size()-1],v3[0])); if(y) ans.pb(P(v2[v2.size()-1],v3[0])); } rep(i,v3.size()-1) ans.pb(P(v3[i],v3[i+1])); if(ans.size()>a[3]) pr(-1); else { int n=0; rep(i,ans.size()) n=max(n,max(ans[i].F,ans[i].S)+1); pr(n,ans.size()); rep(i,ans.size()) pr(ans[i].F,ans[i].S); } } int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}