//Failure will never overtake me if my determination to succeed is strong enough
#include <bits/stdc++.h>

using namespace std;

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

    long long k;
    cin >> k;
    unsigned long long C[1001][5];

    for(int i = 0; i <= 1000; i++)
    {
        for(int j = 0; j <= min(i, 2); j++)
        {
            // Base Cases
            if (j == 0 || j == i)
                C[i][j] = 1;

            else
                C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
        }
    }

    long long pref[1001];
    pref[0] = C[0][2];

    for(int i = 1; i <= 1000; i++)
    {
        pref[i] = pref[i-1] + C[i][2];
    }


    vector<vector<int> > v;
    int y = 0, offset = 0;
    int rez = 0;
    while(k > 0)
    {
        //cout << "usao\n";
        v.push_back(vector<int>());
        int brt = upper_bound(pref, pref+1001, k)-pref;
        brt--;
        //cout << pref[brt] << endl;
        k -= pref[brt];

        brt++;
        for(int i = 0; i < brt; i++)
        {
            rez++;
            v[y].push_back(i+offset);
        }

        y++;
        offset += brt+163;
    }

    cout << rez << "\n";
    for(int i = 0; i < v.size(); i++)
    {
        for(auto j: v[i])
        {
            cout << j << " " << i*157 << "\n";
        }
    }

}