#include #define FOR(i,b,e) for(int i=(b); i <= (e); ++i) #define FORD(i,b,e) for(int i=(b); i >= (e); --i) #define SIZE(c) (int) (c).size() #define FORE(i,c) FOR(i,0,SIZE(c)-1) #define FORDE(i,c) FORD(i,SIZE(c)-1,0) #define pb push_back #define mp make_pair #define st first #define nd second using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; typedef vector VI; typedef vector VB; typedef vector VP; typedef vector VL; typedef vector VPL; typedef vector VVI; typedef vector VVL; typedef vector VVB; typedef vector VVP; const int MOD = 1000000007; const int INF = 1000000001; const ll LINF = 1000000000000000001LL; /*************************************************************************/ ll pairs(ll x) { return x * (x-1) / 2; } int main() { ll t, b, f, c; cin >> t >> b >> f >> c; int n = t + 1; FOR(x,0,n-1) { int y = n - 1 - x; if (f + b <= pairs(x+1) + y && f <= pairs(x) && c <= x * y + pairs(y)) { VVI g(n); FOR(i,1,y) { g[0].pb(i); if (b) { b--; g[i].pb(0); } FOR(j,y+1,n-1) { if (!c) break; c--; g[j].pb(i); } FOR(j,1,i-1) { if (!c) break; c--; g[i].pb(j); } } VI path = {0}; FOR(i,y+1,n-1) { int par = (i == y+1 ? 0 : i-1); g[par].pb(i); for (int j : path) { if (!f && !b) break; if (f && j != par) { f--; g[j].pb(i); } else if (b) { b--; g[i].pb(j); } } path.pb(i); } cout << n << '\n'; for (auto &v : g) { cout << SIZE(v) << ' '; for (int e : v) cout << 1 + e << ' '; cout << '\n'; } return 0; } } cout << -1; return 0; } /*************************************************************************/