#include <iostream>
#include <vector>
using namespace std;

int l;
const int n = 20;
int m = 0;
vector<int> et[n];
vector<int> ec[n];

int main() {
	int i, j;
	
	cin >> l;
	
	int mul = 1;
	for (i = n - 2; i >= 1; i--) {
		et[i].push_back(i + 1);
		ec[i].push_back(mul);
		et[i].push_back(i + 1);
		ec[i].push_back(0);
		mul *= 2;
		m += 2;
	}
	
	int offset = 0;
	for (i = 1; i < n; i++) {
		mul = (1 << (n - 1 - i));
		while (offset + mul <= l) {
			et[0].push_back(i);
			ec[0].push_back(offset);
			offset += mul;
			m++;
		}
	}
	
	cout << n << " " << m << endl;
	for (i = 0; i < n; i++) {
		for (j = 0; j < et[i].size(); j++) {
			cout << i + 1 << " " << et[i][j] + 1 << " " << ec[i][j] << endl;
		}
	}
	return 0;
}