#include using namespace std; int main(){ long long N; cin >> N; int leafs = 4; int tree_size = 3 * (leafs * (leafs-1)) / 2; int total_tree_size = tree_size + leafs; int rows = leafs; int width = 2 * leafs - 1; int total_cut = total_tree_size + width * rows; cout << total_cut << endl; // leafs for(int i=0; i < leafs; i++){ cout << -2 * i << " " << 2 * i << " " << 1 << endl; } // tree for(int it = 0; it < leafs - 1; it++){ int x = 0; int y = it*2; for(int l = 0; l < leafs - 1 - it; l++){ int xx = x - 2*l; int yy = y + 2*l; cout << xx << " " << yy + 1 << " " << 0 << endl; cout << xx << " " << yy + 2 << " " << 0 << endl; cout << xx - 1 << " " << yy + 2 << " " << 0 << endl; } } // rows for(int row = 0; row < rows; row++){ for(int col = 0; col < width; col++){ cout << 1 + col << " " << row * 2 << " " << 0 << endl; } } // harvest vector powers; long long pow = 0; while(N > 0){ if(N % 2 == 1){ powers.push_back(pow); } pow += 1; N /= 2; } // cout << "DEBUG: "; // for(int x : powers){ // cout << x << " "; // } // cout << endl; int H = powers.size(); int D = leafs * 2 - 2; cout << H << " " << D << endl; for(int p : powers){ cout << 2 * leafs - 2 - 2 * p << " " << 2 * p << endl; } return 0; }