#include #include using namespace std; using ll = long long; ll t0[2][100]; int main() { ios::sync_with_stdio(false); ll* t = t0[0]; ll* te = t0[1]; t[1] = 1; const int D = 40; const int K = 41; for (int d = 1; d <= D; d++) { swap(t, te); for (int i = 1; i <= K; i++) { t[i] = te[i - 1] + te[i] + te[i + 1]; } } ll N; cin >> N; const int S = 100; cout << K * S << "\n"; for (int i = 0; i < S; i++) { cout << 2 * i << " 1 1\n"; for (int j = 2; j <= K; j++) { cout << 2 * i << " " << j << " 0\n"; } } vector> er; for (int i = 1; i <= K; i++) { for (int j = 0; j < S; j++) { if (N >= t[i]) { N -= t[i]; er.emplace_back(2 * j, i); } } } cout << er.size() << " " << D << "\n"; for (auto p : er) { cout << p.first << " " << p.second << "\n"; } }