#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

    ll k;
    cin >> k;
    ll i=3,cur=1;
    vector<ll> v;
    v.push_back(cur);
    while(cur<k)
    {
        i++;
        cur=i*(i-1)*(i-2)/6;
        v.push_back(cur);
    }
    vector<ll> b;
    ll br=0;
    while(k>0)
    {
        ll pos=lower_bound(v.begin(),v.end(),k)-v.begin();
        if (v[pos]!=k) pos--;
        k-=v[pos];
        br+=pos+3;
        b.push_back(pos+3);
    }
    ll x=0,y=0,c=1;
    ll n=b.size();
    cout << br-n+1 << "\n";
    for (ll i=0;i<n;i++)
    {
        if (i==0) { cout << "0 0\n"; y=1; }
        else
        {
            if (c==1) { --x; y++; } else { ++x; --y; }
        }
        for (ll j=1;j<b[i];j++)
        {
            cout << x << " " << y << "\n";
            if (c==1) y++; else x++;
        }
        if (c==1) c=0; else c=1;
    }
    return 0;
}