#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;

int main() {
    unordered_map<int, int> dict1;
    for(int a = 0; a <= 1000; a++) {
        for(int b = 0; b <= 1000; b++) {
            dict1[a + b]++;
        }
    }
    unordered_map<int, int> dict2;
    for(int c = 0; c <= 1000; c++) {
        for(int d = 0; d <= 1000; d++) {
            dict2[c + d]++;
        }
    }
    for(int N; cin >> N; ) {
        int ans = 0;
        for(auto it : dict1) {
            if(dict2.count(N - it.first)) {
                ans += dict1[N - it.first] * it.second;
            }
        }
        cout << ans << endl;
    }
}