#include <bits/stdc++.h>

using namespace std;

int cnt[2010];

int main() {
    int sum = 0;
    for (int i = 0; i <= 2000; i++)
        cnt[i] = 1000 - abs(i - 1000) + 1;
    
    int n;
    while (scanf("%d", &n) != EOF) {
        long long ans = 0;
        for (int i = 0; i <= n; i++) {
            if (i > 2000 || n - i > 2000) continue;
            ans += cnt[i] * cnt[n - i];
        }
        
        cout << ans << endl;
    }

    return 0;
}
