#include<bits/stdc++.h>
using namespace std;
long long tab[1005][1005];
long long pom[1005][1005];
vector<pair<int,int>> v;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    cout<<40200<<'\n';
    for(int x=2;x<=400;x+=2)
    {
        for(int y=1;y<=201;y++)
        {
            cout<<x<<" "<<y<<" ";
            if(y == 101)
            {
                tab[x][y] = 1;
                cout<<1;
            }
            else
                cout<<0;
            cout<<'\n';
        }
    }
    long long maks = 1;
    int it = 0;
    while(maks < 1e18)
    {
        for(int x=2;x<=400;x+=2)
            for(int y=1;y<=201;y++)
                pom[x][y] = tab[x][y-1] + tab[x][y] + tab[x][y+1];
        for(int x=2;x<=400;x+=2)
            for(int y=1;y<=201;y++)
            {
                tab[x][y] = pom[x][y];
                maks = max(maks, tab[x][y]);
            }
        it++;
    }
    long long a;
    cin>>a;
    for(int y=101;y>=1;y--)
    {
        int x = 2;
        while(a >= tab[x][y] && a)
        {
            a -= tab[x][y];
            x += 2;
            v.push_back({x,y});
        }
    }
    cout<<v.size()<<" "<<it<<'\n';
    for(auto x:v)
        cout<<x.first<<" "<<x.second<<'\n';
	return 0;
}
