#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MOD = 1e9+7;
const ll INF = 1e9;
map<ll,ll>mp;
vector<pair<ll,ll> >ans;

void print(){
    cout<<(int)ans.size()<<"\n";
    for(auto e:ans){
        cout<<e.first<<" "<<e.second<<"\n";
    }
    exit(0);
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    vector<ll>v;
    for(ll i=3;;i++){

        ll s=i*(i-1)*(i-2)/6;
        if(s>100000000LL)break;
        v.push_back(s);
        mp[s]=i;
    }

    ll k;
    cin>>k;
    int ind=(int)v.size()-1;
    vector<ll>r;
    while(k>0){
        while(v[ind]>k)ind--;
        k-=v[ind];
        r.push_back(mp[v[ind]]);
    }

    ll x=-INF;
    int y=INF;

    for(ll i=0;i<r[0];i++){
        ans.push_back({x,y});
        x++;
    }
    if(r.size()<2)print();

    x=-INF;
    y--;

    for(ll i=0;i<r[1];i++){
        ans.push_back({x,y});
        x++;
    }

    y--;

    ll prevbegin=-INF;
    ll prevend=x-1;

    for(int i=2;i<r.size();i++){
        ll d=(prevend-prevbegin)+1;
        ll newx=prevend+d;
        prevbegin=prevend-(r[i-1]-1);

        for(int j=0;j<r[i];j++){
            ans.push_back({newx,y});
            sz[y]++;
            newx++;
        }

        prevend=newx-1;
        y--;
    }

    print();
    return 0;
}