#include<bits/stdc++.h>

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

ll fakt[1100];
ll inv[1100];
ll MOD = 1e9 + 7;
ll binomni[1000];

vector<int> niz;

ll mul(ll a, ll b)
{
    return (a*b)%MOD;
}

ll inverz(ll a, ll k)
{
    if(k == 0) return 1;
    ll a2 = inverz(a, k/2);
    a2 = mul(a2, a2);
    if(k % 2 == 1) a2 = mul(a2, a);
    return a2;
}

ll binomniKoef(ll n, ll k)
{
    ll res = mul(fakt[n], inv[k]);
    res = mul(res, inv[n-k]);
    return res;
}

void gradi(int x, int y, int cnt)
{
    while(cnt--)
    {
        cout << x << " " << y << "\n";
        y++;
    }
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    fakt[0] = 1;
    for(ll i = 1; i < 1000; i++) fakt[i] = mul(fakt[i-1],i);
    for(ll i = 0; i < 1000; i++) inv[i] = inverz(fakt[i], MOD - 2);

    for(int i = 3; i <= 900; i++)
    {
        binomni[i] = binomniKoef(i, 3);
        //cout << binomni[i] << "\n";
    }

    int k;
    cin >> k;
    int ind = 900;
    int br = 0;
    int s = 0;
    while(k > 0)
    {
        br++;
        while(binomni[ind] > k)
            ind--;
        k -= binomni[ind];
        s += ind;
        //cout << ind << "\n";
        niz.pb(ind);
        //cout << binomni[ind] << "\n";
    }
    cout << s << "\n";
    gradi(0,0,niz[0]);
    int vrhX = 2;
    int vrhY = niz[0];
    int dx = 100;
    int dy = 1000000;
    for(int i = 1; i < niz.size(); i++)
    {
        gradi(vrhX + dx, vrhY + dy, niz[i]);
        vrhX = vrhX + dx + 1;
        vrhY = vrhY + dy + niz[i];
        dx += dx*0.15;
        dy -= 100000;

    }

    return 0;
}