#include <bits/stdc++.h>

using namespace std;

long long niz[10000000];
long long granica = 100000000;

long long factoriel(long long a)
{
    long long ret = 1;
    for(long long i = 1; i <= a; i++)
        ret*=i;

    return ret;
}

long long calculate_A_nad_B(long long a, long long b)
{
    if(a == b) return 1;
    long long ret = 0;
    long long pom1,pom2,pom3;
    pom1 = factoriel(a); pom2 = factoriel(b); pom3 = factoriel(a-b);
    ret = pom1/(pom2*pom3);

    return ret;
}

int generisi_niz()
{
    long long base = calculate_A_nad_B(4,3);
    niz[3] = 1;
    niz[4] = base;
    int n = 4;
    while((base*(n+1)/(n-2)) < granica)
    {
        base = base*(n+1)/(n-2);
        niz[++n] = base;
    }
    return n;
}

struct tacka
{
    long long x;
    long long y;
};

int brTacaka[2010];
long long najbliziBroj(long long K,int n,int index)
{
    for(int i = n; n>=1; i--)
    {
        if(niz[i] <= K) {brTacaka[index] = i; return niz[i];}
    }
    return -1;
}

long long duzine[10000000];
long long generisi_duzine(long long K, int n)
{
    int m = 0; long long d = 0; long long pom = 0;
    while(K >= 1)
    {
        d = najbliziBroj(K,n,m);
        duzine[m++] = d;
        pom = d;
        K = K-pom;
    }
    return m;
}

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

    int n = generisi_niz();
    long long K;
    cin>> K;

    long long m = generisi_duzine(K,n);


    /*cout<<"N"<<" --> "<<"K"<<endl;
    for(int i = 3; i <= n; i++)
    {
        cout<<i<<" --> "<<niz[i]<<endl;
    }

    for(int i = 0; i < m; i++)
    {
        cout<<duzine[i]<<" ";
    }
    cout<<endl;
    for(int i = 0; i < m; i++)
    {
        cout<<brTacaka[i]<<" ";
    }
    cout<<endl;*/

    long long pomerajX = 100000;
    long long pomerajY = 100000;
    long long trX,trY,x,y; x = y = trX = trY = 0;
    long long brt = 0;
    for(int i = 0; i<m; i++)
        brt+=brTacaka[i];

    if(m>1) cout<<brt-1<<endl;
    else cout<<brt<<endl;
    cout<<x<<" "<<y<<endl;
    for(int i = 0; i < m; i++)
    {
        int p = brTacaka[i];
        for(int j = 1; j < p; j++)
        {
            trX+=pomerajX;
            x = trX;
            trY++;
            y = trY;
            cout<<x<<" "<<y<<endl;
        }
        //x = trX + pomerajX;
        trY+=pomerajY;
    }



    //cout<<endl<<"Najblizi broju K: "<<najbliziBroj(K,n);

    return 0;
}