#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T> void dbg(T x) { cout << x << "\n"; }
template<typename T, typename U> static void chmin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void chmax(T &x, U y) { if (x < y) x = y; }

static int cnt1[2018], cnt2[2018];

int main() {
    int n;
    while (cin >> n) {
        memset(cnt1, 0, sizeof(cnt1));
        memset(cnt2, 0, sizeof(cnt2));
        rep(c, 1001) rep(d, 1001) {
            int x = n - c - d;
            if (0 <= x&&x <= 2000) cnt1[x]++;
        }
        rep(a, 1001) rep(b, 1001) {
            cnt2[a + b]++;
        }

        ll ans = 0;
        rep(i, 2001) ans += cnt1[i] * cnt2[i];
        cout << ans << "\n";
    }
    return 0;
}

