import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math, std.container, std.typecons;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	int L;
	scanf("%d", &L);
	int n = 20, m = (n-2)*2;
	int l = L;
	foreach (i; 0..n) {
		m += l&1;
		if (i == n-1) m += l&1;
		l >>= 1;
	}
	writeln(n," ",m);
	foreach (i;0..n-2) {
		writeln(i+1," ",i+2," ",0);
		writeln(i+1," ",i+2," ",1<<i);
	}
	l = L;
	foreach (i; 0..n) {
		if (l>>i&1) {
			l ^= 1<<i;
			if (i+1 < n) {
				writeln(i+1," ",n," ",l);
			} else {
				writeln(n-1," ",n," ",l);
				writeln(n-1," ",n," ",l+(1<<(i-1)));
			}
		}
	}
}