#include <iostream>
using namespace std;

int a[4001];

int main()
{
    for(int i = 0; i <= 1000; ++i){
        for(int j = 0; j <= 1000; ++j){
            a[i+j]++;
        }
    }
    
    int n;
    while(cin >> n){
        int ans = 0;
        for(int i = 0; i <= n; ++i){
            ans += a[i] * a[n-i];
        }
        cout << ans << endl;
    }
}