#include using namespace std; typedef long long int ll; typedef pair pii; bool R(){return true;} template bool R(T & x, Args & ... args){return cin >> x && R(args...);} void init_io(){ios::sync_with_stdio(false);cin.tie(0);} #define PB push_back #define FOR(prom, a, b) for(int prom = (a); prom < (b); prom++) #define FORDE(prom, a, b) for(int prom = (a); prom >= (b); prom--) #define ALL(vec) (vec).begin(), (vec).end() #define MM(co, cim) memset((co), (cim), sizeof((co))) #define DEB(x) cerr << ">>> " << #x << " : " << x << endl; #define INF 1000000007 #define INFLL 4000000000000000007LL #define MAX_POWER 59 #define WIDTH (MAX_POWER + 1 + 1) int sx, sy, pows[114]; ll n; map pts; set res; void add_delay (int x, int y, int length) { pts[{x, y}] = 1; FOR(i, 1, length + 1) pts[{x, y - i}] = 0; } void add_power (int x, int y, int pow) { int delay_length = MAX_POWER - pow; add_delay(x, y, delay_length); int px = x; int py = y - delay_length; FOR(i, 0, pow + 1) FOR(j, 0, pow + 1) if ((i || j) && (i + j) <= pow) pts[{px + i, py - j}] = 0; } void get_pow (int pow) { int px = pows[pow]; int py = sy - (MAX_POWER - pow) - pow; FOR(i, 0, pow + 1) res.insert({px++, py++}); } void solve () { R(n); sx = 0; sy = 120; int cx = sx; FOR(pow, 0, MAX_POWER + 1) { pows[pow] = cx; add_power(cx, sy, pow); cx += pow + 1 + 1; } int cpow = 0; while (n) { if (n & 1) get_pow(cpow); n >>= 1; ++cpow; } printf("%d\n", (int)pts.size()); for (auto en : pts) printf("%d %d %d\n", en.first.first, en.first.second, en.second); printf("%d %d\n", (int)res.size(), MAX_POWER); for (auto en : res) printf("%d %d\n", en.first, en.second); } int main () { init_io(); int T = 1; //R(T); while (T--) solve(); return 0; }