#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

struct edge {
    ll from, to, val;
};

signed main() {
    ll L;
    cin>>L;

    vector<edge> edges;

    ll d = 0;
    while ((1ll << (d+1)) <= L){
        d++;
    }

    rep(i,1,d+1){
        edges.push_back({i,i+1,0});
        edges.push_back({i,i+1,1LL<<(i-1)});
    }

    ll val = 1ll << d; //32
    for (ll i = d-1; i>=0; i--) {
        if ((L & (1ll<<i)) == 0)
            continue;
        // printf("val=%d\n",val);
        edges.push_back({i+1,d+1,val});
        val += 1ll << i;
    }

    printf("%d %d\n", d+1, edges.size());
    for(auto e : edges){
        printf("%d %d %d\n", e.from, e.to, e.val);
    }

    return 0;
}
