#include #define forn(i, n) for (int i = 0; i < n; i++) #define re return #define pb push_back #define all(a) a.begin(), a.end() #define sz(a) (int)a.size() #define x first #define y second #define point pair #define re return #define se second #define fi first #define mp(a, b) make_pair(a, b) #define mp1(a, b, c, d) make_pair(mp(a, b), mp(c, d)) using namespace std; typedef long long ll; const int ma = 131072; const ll mod = (1e9) + 7; ll n, num, t, f, b, c, sumh, h[100002]; vector fin, stc, e[100002]; void make_tree(int h1) { forn (i, h[h1]) { num++; for (int j = 0; c > 0 && j < sz(fin); j++) { c--; e[num].push_back(fin[j]); } forn (i, sz(stc) - 1) { if (!f) break; f--; e[stc[i]].push_back(num); } forn (i, sz(stc)) { if (!b) break; b--; e[num].push_back(stc[i]); } if (h1) e[stc[sz(stc) - 1]].push_back(num); stc.push_back(num); if (i == 0)make_tree(h1 + 1); stc.pop_back(); fin.push_back(num); } } int main() { iostream::sync_with_stdio(0); //freopen("a.in", "r", stdin); cin >> t >> f >> b >> c; n = t + 1; sumh = max(t + f, b); if ((n - 1) * (n - 1) - 2LL * sumh < 0) { cout << -1; re 0; } int k = n - 1; h[0] = 1; for (int hh = n - 1; hh > 0; hh--) { if (sumh > (hh - 1) * k || h[hh + 1]) { h[hh] = max(1LL, sumh - k * (hh - 1)); k -= h[hh]; sumh -= h[hh] * hh; } } if (k < 0) { cout << -1; re 0; } make_tree(0); cout << n << "\n"; for (int i = 1; i <= n; i++) { cout << sz(e[i]) << " "; for (auto v : e[i]) cout << v << " "; cout << "\n"; } }