//#pragma comment(linker,"/STACK:16777216") /*16Mb*/ #pragma comment(linker,"/STACK:33554432") /*32Mb*/ #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,a,b) for (int i = (a); i < (b); i++) #define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--) #define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++) #define FILL(a,value) memset(a, value, sizeof(a)) #define SZ(a) (int)a.size() #define ALL(a) a.begin(), a.end() #define MP make_pair #define PB push_back typedef long long LL; typedef vector VI; typedef pair PII; const double PI = acos(-1.0); const int INF = 1000 * 1000 * 1000 + 7; const LL LINF = INF * (LL) INF; const int MAX = 131072; int n, b, f, bd; int N; vector g[200000]; vector G[200000]; vector st; void dfs(int v) { st.PB(v); FOR (i,0,SZ(st)-1) { if (!b) break; b--; G[v].PB(st[i]); } FOR (i,0,SZ(st)-2) { if (!f) break; f--; //cout << st[i]<<" &*"<> n >> b >> f >> bd; N = n+1; FOR (i,2,N+1) g[i/2].PB(i); dfs(1); while (bd) { RFOR (i,N+1,1) RFOR (j,i,1) { if (!bd) break; int I = i; while (I < j) I /= 2; if (I != j) { if (bd) { bd--; int I = i, J = j; while (I%2 == J%2) I/=2, J/=2; if (J&1) G[j].PB(i); else G[i].PB(j); } } } } if (bd || b || f) cout << -1; else { cout << N << endl; FOR (j,1,N+1) { cout << g[j].size()+G[j].size(); FOR (i,0,g[j].size()) cout << " "<