#include <bits/stdc++.h>

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

int f(int x){
    return (x * (x - 1) * (x - 2)) / 6;
}

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    vi c;
    for (int i = 3; i <= 2000; ++i){
        c.push_back(-1 * f(i));
    }

    sort(c.begin(), c.end());  

    int n;
    cin >> n;

    vi a;
    while(n){
        int ind = lower_bound(c.begin(), c.end(), -1 * n) - c.begin();

        int x = -1 * c[ind];

        for (int i = 0; i < n / x; ++i){
            a.push_back(2000 - ind);
        }

        n %= x;
    }

    sort(a.begin(), a.end());

    int sol = 0;
    for (auto& i : a)
        sol += i;

    int l = a.size();

    int x = -1000'000'000, y = x;
    vp s = {{x, y}, {x + 1, y}};
    for (int i = 2; i < a.size(); ++i){
        int len = s.size();

        pi p1 = s[len - 2], p2 = s[len - 1];
        int y3 = (p2.second + a[i - 1] - p1.second) * (p1.first + 2) + p1.second - (p2.second - p1.second + a[i - 1]) * p1.first;
        pi p = {p2.first + 1, (y3 + 1)};
        s.push_back(p);
    }

    cout << sol << '\n';
    for (int i = 0; i < l; ++i){
        int x = s[i].first, y = s[i].second;
        for (int j = 0; j < a[i]; ++j){
            cout << x<< ' ' << y << '\n';
            ++y;
        }
    }
}