#include using namespace std; int main(){ long long N; cin >> N; int leafs = 61; int total_tree_size = leafs * (leafs + 1) / 2; int rows = leafs; int width = leafs - 1; int total_cut = total_tree_size + width * rows; cout << total_cut << endl; // leafs for(int i=0; i < leafs; i++){ cout << -1 * i << " " << i << " " << 1 << endl; } // tree for(int x = 0; x > - leafs; x--){ for(int y = 1 - x; y < leafs; y++){ cout << x << " " << y << " " << 0 << endl; } } // rows for(int row = 0; row < rows; row++){ for(int col = 0; col < width; col++){ if (row % 2 == 0){ cout << col << " " << row << " " << 0 << endl; }else{ cout << -leafs + 1 + row << " " << leafs + col << " " << 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 - 1; cout << H << " " << D << endl; for(int p : powers){ if (p % 2 == 0){ cout << leafs - 1 - p << " " << p << endl; }else{ cout << -leafs + 1 + p << " " << leafs + leafs - 2 - p << endl; } } return 0; }