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

const int maxd = 20;

int l, tl, dl, ce, t = 1;
bool b[maxd];

signed main () {
    scanf("%d", &l);
    tl = l;
    while (l) {
        if (l & 1) {
            b[dl] = 1;
            ce++;
        }
        l >>= 1;
        dl++;
    }
    printf("%d %d\n", dl, (dl - 1) * 2 + ce - 1);
    l = tl;
    for (int i = 1; i < dl; ++i) {
        printf("%d %d %d\n", i, i + 1, 0);
        printf("%d %d %d\n", i, i + 1, t);
        if (b[i - 1]) {
            printf("%d %d %d\n", i, dl, l - t);
            l -= t;
        }
        t <<= 1;
    }
}
