import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto L = readln.chomp.to!long;
    long[] nList;
    while (L > 0) {
        const n = log2(L).to!long;
        L -= 2^^n;

        nList ~= n;
    }
    const N = nList.sum + nList.length + 2; //each island + start + end
    const M = nList.sum * 2 + nList.length * 2; //each island
    writefln("%d %d", N, M);

    int start = 2;
    int offset = 0;
    foreach (n; nList) {
        writefln("%d %d %d", 1, start, offset); // start to island
        foreach (i; 0..n) {
            writefln("%d %d %d", start + i, start + i + 1, 0);
            writefln("%d %d %d", start + i, start + i + 1, 2^^i);
        }
        writefln("%d %d %d", start + n, N, 0); // island to end
        start += n+1;
        offset += 2^^n;
    }
}
