#include <bits/stdc++.h>

struct Edge {
	int from, to, distance;
};

int main()
{
	int l;
	scanf("%d", &l);

	std::vector<Edge> edges;
	int n;
	for (int i = 0; (1 << (i + 1)) <= l; i++)
	{
		edges.push_back((Edge){i, i + 1, 0});
		edges.push_back((Edge){i, i + 1, 1 << i});
		n = i + 1;
	}
	for (int i = 0; (1 << (i + 1)) <= l; i++)
	{
		if (!((1 << i) & l)) continue;
		edges.push_back((Edge){i, n, (l & ~((1 << i) - 1) - (1 << i))});
	}
	
	printf("%d %d\n", n + 1, edges.size());
	for (auto &e: edges)
	{
		printf("%d %d %d\n", e.from + 1, e.to + 1, e.distance);
	}

	return 0;
}