#include <bits/stdc++.h>

using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long k;
    cin>>k;
    long long h=1000,l=3,y=-pow(10,8),x=-pow(10,8),n=0,cn=0,pcn=0;
    long long lin=1;
    vector<pair<long long,long long>> v;
    while(k>3)
    {
        h=1000;
        l=3;
        while(h-l>10)
        {
            long long mid=(h+l)/2;
            if(mid*(mid-1)*(mid-2)/6<=k)
                l=mid;
            else h=mid;
        }
        for(long long i=h;i>=l;i--)
        {
            if(i*(i-1)*(i-2)/6<=k)
            {
                n+=i;
                cn+=i;
                k-=i*(i-1)*(i-2)/6;
                //cout<<i<<"\n";
                break;
            }
        }
        for(long long i=0;i<cn;i++)
        v.push_back({x+i,y});
            //cout<<x+i<<" "<<y<<"\n";
        if(lin==-1)
        {
            y+=3000+n;
            x+=pcn+1;
        }
        else
        {
            y+=1;
            pcn=cn;
        }
        lin*=-1;
        cn=0;
    }
    for(long long i=0;i<k;i++)
    {
       // cout<<"A"<<"\n";
        for(long long j=0;j<3;j++)
        v.push_back({x+j,y});
           // cout<<x+j<<" "<<y<<"\n";
        n+=3;
        cn=3;
        if(lin==-1)
        {
            y+=3000+n;
            x+=pcn+1;
        }
        else
        {
            y+=1;
            pcn=cn;
        }
        lin*=-1;
    }
    cout<<n<<"\n";
    for(long long i=0;i<v.size();i++)
        cout<<v[i].first<<" "<<v[i].second<<"\n";
}