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

vector<int> cx,cy,cz;
vector<int> outx;
vector<int> outy;

void drawpascal(int s, int x, int y) {
	for(int i = 0; i <= 60; i++) {
		for(int j = 0; j <= 60; j++) {
			if(i + j <= 60) {
			cx.push_back(x+i);
			cy.push_back(y+j);
			cz.push_back(0);
			}
			//cout<<x+i<<" "<<y+j<<" "<<0<<endl;
		}
	}
	for(int i = 1; i <s; i++) {
			cx.push_back(x-i);
			cy.push_back(y);
			cz.push_back(0);
	//	cout<<x-i<<" "<<y<<" "<<0<<endl;
	}
			cx.push_back(x-s);
			cy.push_back(y);
			cz.push_back(1);
	//cout<<x-s<<" "<<y<<" "<<1<<endl;

}
void getpascal(int nr) {
	int x = 205*(60-nr);
	int y = 0;
	for(int i = 0; i <= nr; i++) {
		outx.push_back(x+i);
		outy.push_back(nr - i);
	}
}
int main() {
	ios_base::sync_with_stdio(0);
	long long n;
	cin>>n;
	for(int i = 0; i <= 60; i++) {
		drawpascal(i+1,i*205, 0);
	}
	cout<<cx.size()<<endl;
	for(int i = 0; i < cx.size();i++) cout<<cx[i]<<" "<<cy[i]<<" "<<cz[i]<<endl;
	int tmp = 0;
	while(n) {
		if(n%2) getpascal(tmp);
		tmp++;
		n/=2;
	
	}
	
	cout<<outx.size()<<" "<<60;
	cout<<endl;
	for(int i =0 ; i < outx.size();i++) cout<<outx[i]<<" "<<outy[i]<<endl;
}
