#include <iostream>
#include <cstring>

using namespace std;

typedef long long ll;

ll memo[4001];
ll solve(int n, int r = 4) {
    if (n < 0) return 0;
    if (r == 1) return (0 <= n && n <= 1000) ? 1 : 0;
    if (r == 2 && memo[n] >= 0) return memo[n];
    ll ret = 0;
    for (int i = 0; i <= 1000; i++) {
        if (n - i < 0) break;
        ret += solve(n - i, r - 1);
    }
    if (r == 2) memo[n] = ret;
    return ret;
}

int main() {
    int n;
    memset(memo, -1, sizeof(memo));
    while (cin >> n) {
        cout << solve(n) << endl;
    }
    return 0;
}