#include using namespace std; typedef long long ll; typedef double lf; typedef long double Lf; typedef pair pii; typedef pair pll; #define TRACE(x) cerr << #x << " " << x << endl #define FOR(i, a, b) for (int i = (a); i < int(b); i++) #define REP(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define _ << " " << #define fi first #define sec second #define mp make_pair #define pb push_back const int MAXN = 400; ll a[MAXN][MAXN]; ll b[MAXN][MAXN]; vector> flowers; int main() { ll x; cin >> x; a[0][200] = 1; FOR(i, 1, MAXN) { FOR(j, 100, 150) { // a[i][j] = rand() % 2; } } REP(i, 1) REP(j, MAXN) flowers.pb({a[i][j], {i * 2, j}}); cout << flowers.size() << endl; for (auto pp : flowers) { cout << pp.second.first << " " << pp.second.second << " " << pp.first << endl; } int days = 0; ll maxi = 0; do { days ++; maxi = 0; REP(i, 1) { FOR(j, 1, MAXN - 1) { b[i][j] = a[i][j] + a[i][j - 1] + a[i][j + 1]; } REP(j, MAXN) { a[i][j] = b[i][j]; maxi = max(maxi, a[i][j]); } } } while (maxi * 2 < x); vector> candidates; REP(i, 1) REP(j, MAXN) { candidates.pb({a[i][j], {i * 2, j}}); } sort(candidates.begin(), candidates.end()); vector sol; while(candidates.size()) { auto pp = candidates.back(); candidates.pop_back(); if (pp.first == 0) continue; while (pp.first <= x) { x -= pp.first; sol.pb(pp.second); } } assert(sol.size() <= 10000); assert(days <= 100); assert(x == 0); cout << sol.size() << " " << days << endl; for (auto pp : sol) { cout << pp.first << " " << pp.second << endl; } return 0; }