#include #define fi first #define se second #define p_b push_back #define pll pair #define pii pair #define m_p make_pair #define all(x) x.begin(),x.end() #define sset ordered_set #define sqr(x) (x)*(x) #define pw(x) (1ll << x) #define sz(x) (int)x.size() #define fout(x) {cout << x << "\n"; return; } using namespace std; typedef long long ll; typedef long double ld; const int MAXN = 1123456; const int M = 1e7; const ll inf = 1e18; const long long mod = 1e9 + 7; const long long N = 3e5; template void vout(T s){cout << s << endl;exit(0);} int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; ll x, y; x = y = 1; vector ans; vector < pair > vans; ll d = 80; for(ll i = 60; i >= 0; i--)if((n & pw(i))){ for(int j = 0; j <= i; j++){ vans.p_b({{x + j, y + j}, 1}); } ans.p_b({x, y + d - i}); for(int j = 1; j <= d - i; j++){ vans.p_b({{x, y + j}, 0}); } } cout << vans.size() << "\n"; for(auto i : vans){ cout << i.fi.fi << " " << i.fi.se << " " << i.se << "\n"; } cout << ans.size() << " " << d << "\n"; for(auto i : ans){ cout << i.fi << " " << i.se << "\n"; } return 0; }