#include <iostream>

using namespace std;

int ab[2001];

int main()
{
    int n;

    while (cin >> n) {
        int ans = 0;

        for (int i = 0; i < 2001; i++)
            ab[i] = 0;
        
        for (int a = 0; a <= 1000; a++)
            for (int b = 0; b <= 1000; b++)
                ab[a + b]++;
        
        for (int c = 0; c <= 1000; c++)
            for (int d = 0; d <= 1000; d++)
                if (n - c - d >= 0 && n - c - d <= 2000)
                    ans += ab[n - c - d];

        cout << ans << endl;
    }

    return 0;
}