#include using namespace std; #include #include using namespace __gnu_pbds; template using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; template using ordered_map = tree, rb_tree_tag, tree_order_statistics_node_update>; typedef long long ll; typedef long double ld; typedef pair pii; typedef pair pll; typedef vector vi; typedef vector vll; #define FOR(i,j,k,in) for(int i=(j); i < (k);i+=in) #define FORD(i,j,k,in) for(int i=(j); i >=(k);i-=in) #define REP(i,b) FOR(i,0,b,1) #define REPD(i,b) FORD(i,b,0,1) #define pb push_back #define mp make_pair #define ff first #define ss second #define all(x) begin(x), end(x) #define MANY_TESTS int tcase; cin >> tcase; while(tcase--) const double EPS = 1e-9; const int MOD = 1e9+7; const ll INFF = 1e18; const int INF = 1e9; const ld PI = acos((ld)-1); const vi dy = {1, 0, -1, 0, -1, 1, 1, -1}; const vi dx = {0, 1, 0, -1, -1, 1, -1, 1}; void DBG(){cout << "]" << endl;} template void DBG(const T& head, const U... args){ cout << head << "; "; DBG(args...); } #define dbg(...) cout << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__); #define chk() cout << "Check at line(" << __LINE__ << ") hit." << endl; template ostream& operator<<(ostream& out, const array &v){out << "["; REP(i, U) out << v[i] << ", "; out << "]"; return out;} template ostream& operator<<(ostream& out, const pair &par) {out << "[" << par.first << ";" << par.second << "]"; return out;} template ostream& operator<<(ostream& out, const set &cont) { out << "{"; for( const auto &x:cont) out << x << ", "; out << "}"; return out; } template ostream& operator<<(ostream& out, const map &cont) {out << "{"; for( const auto &x:cont) out << x << ", "; out << "}"; return out; } template ostream& operator<<(ostream& out, const vector &v){ out << "["; REP(i, v.size()) out << v[i] << ", "; out << "]"; return out;} template istream& operator>>(istream& in, vector &v){ for(auto &x : v) in >> x; return in; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); const int k = 42; const int n = 50; vector tm(n, 0); tm[0] = 1; REP(i, k){ vector ntm = tm; REP(j, n){ if(j > 0){ ntm[j] += tm[j - 1]; } if(j < n - 1) ntm[j] += tm[j + 1]; } tm.swap(ntm); } ll tr; cin >> tr; cout << 200000 << endl; REP(i, 4000){ REP(j, 50) { cout << 2 * i << " " << j << " " << (j == 0 ? 1 : 0) << "\n"; } } vector> arr; REP(j, 50){ arr.pb({tm[j], j}); } vector> ans; sort(all(arr)); int cnt = 0; while(tr > 0){ array curr = {tr + 1, -5}; int id = lower_bound(all(arr), curr) - arr.begin(); id--; ans.pb({2 * cnt, arr[id][1]}); tr -= arr[id][0]; } cout << ans.size() << " " << 42 << "\n"; REP(i, ans.size()){ cout << ans[i][0] << " " << ans[i][1] << "\n"; } return 0; }