#include<bits/stdc++.h>

using namespace std;

long long mennyi[44][46];

void init(){
    mennyi[0][1]=1;
    for(int i=1;i<=43;i++){
        for(int j=1;j<=44;j++){
            mennyi[i][j] = mennyi[i-1][j-1]+mennyi[i-1][j]+mennyi[i-1][j+1];
        }
    }
}

stack<pair<pair<int,int>,int>> s;

stack<pair<int,int>> harv;

int main(){
    init();
    long long target;
    cin >> target;
    int row = 0;
    while(target>0){
        //cout << target << '\n';
        for(int i=1;i<=44;i++){
            if(target >= mennyi[43][i]){
                s.push({{row, 1},1});
                for(int j=2;j<=44;j++){
                    s.push({{row, j},0});
                }
                harv.push({row,i});
                //cout << target << '\n';
                target -= mennyi[43][i];
                //cout << target << '\n';
                row+=2;
                break;
            }
        }
    }
    cout << s.size() << '\n';
    while(s.size()){
        cout << s.top().first.first << ' ' << s.top().first.second << ' ' << s.top().second << '\n';
        s.pop();
    }
    cout << harv.size() << ' ' << 43 << '\n';
    while(harv.size()){
        cout << harv.top().first << ' ' << harv.top().second << '\n';
        harv.pop();
    }
return 0;
}