#include "bits/stdc++.h" // Tomasz Nowak using namespace std; // Poland using LL = long long; #define FOR(i, l, r) for(int i = (l); i <= (r); ++i) #define REP(i, n) FOR(i, 0, (n) - 1) template int ssize(T &&x) { return int(x.size()); } template ostream& operator<<(ostream &out, const pair &p) { return out << '(' << p.first << ", " << p.second << ')'; } template auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) { out << '{'; for(auto it = x.begin(); it != x.end(); ++it) out << *it << (it == prev(x.end()) ? "" : ", "); return out << '}'; } void dump() {} template void dump(T &&x, Args... args) { cerr << x << "; "; dump(args...); } #ifdef DEBUG struct Nl{~Nl(){cerr << '\n';}}; # define debug(x...) cerr << (strcmp(#x, "") ? #x ": " : ""), dump(x), Nl(), cerr << "" #else # define debug(...) 0 && cerr #endif mt19937_64 rng(0); int rd(int l, int r) { return uniform_int_distribution(l, r)(rng); } // end of templates int main() { ios_base::sync_with_stdio(0); cin.tie(0); LL n; cin >> n; int d = 41; int length = 2 * d + 1; assert(length % 2 == 1); cout << d * length << '\n'; REP(y, d) REP(i, length) cout << i << ' ' << 2 * y << ' ' << int(i == length / 2) << '\n'; vector curr(length); curr[length / 2] = 1; FOR(day, 1, d) { vector nw = curr; REP(i, length) { if(i - 1 >= 0) nw[i] += curr[i - 1]; if(i + 1 < length) nw[i] += curr[i + 1]; } curr = nw; debug(day, curr); } debug(*max_element(curr.begin(), curr.end())); /* vector sorted = curr; sort(sorted.rbegin(), sorted.rend()); LL max_step = 0; auto ceil_div = [&](LL a, LL b) { return (a + b - 1) / b; }; REP(i, ssize(sorted) - 1) if(sorted[i + 1] != 0) max_step = max(max_step, ceil_div(sorted[i], sorted[i + 1])); debug(max_step); */ vector>> val_to_coord; REP(y, d) REP(i, length) val_to_coord.emplace_back(curr[i], make_pair(i, 2 * y)); sort(val_to_coord.rbegin(), val_to_coord.rend()); vector> taking_coord; for(auto &p : val_to_coord) { LL val = p.first; auto &coord = p.second; if(n >= val and val > 0) { n -= val; taking_coord.emplace_back(coord); } } assert(n == 0); cout << ssize(taking_coord) << ' ' << d << '\n'; for(auto &coord : taking_coord) { int x = coord.first; int y = coord.second; cout << x << ' ' << y << '\n'; } }