#include <bits/stdc++.h>
#define ll long long
using namespace std;

int binomialCoeff(ll n, ll k)
{
    //Preuzeto sa https://www.geeksforgeeks.org/binomial-coefficient-dp-9/
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = C[j] + C[j-1];
    }
    return C[k];
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    vector<pair<ll, ll>> points;
    ll K;
    cin >> K;
    ll Kcopy = K;
    ll currentX = 0;
    ll currentY = 0;
    ll iteration = 1;
    ll prevBottom = 0;

    while(K > 0)
    {
        ll current = 3;
        ll res = 1;

        while(binomialCoeff(current, 3) <= K){
            res = binomialCoeff(current, 3);
            current++;
        }
        current--;

        K -= res;

        for(ll i = currentY; i < currentY + current; i++)
        {
            points.push_back(make_pair(currentX, i));
        }

        currentX += iteration;
        iteration++;
        currentY += currentY + currentY + currentY + currentY + current + current + current + current;
        //prevBottom = currentY;
    }

    cout << points.size() << endl;
    int len = points.size();
    for(int i = 0; i < len; i++)
    {
        cout << points[i].first << " " << points[i].second << endl;
    }
    return 0;
}