#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;

int memo[4][4001];

int rec(int idx, int left)
{
	if(idx == 3) return (left <= 1000 ? 1 : 0);
	if(memo[idx][left] != -1) return memo[idx][left];

	int ans = 0;
	for(int i=0; i <= min(1000, left); i++){
		ans += rec(idx+1, left - i);
	}

	return ans;
}

int main()
{
	for(int n = 0; cin >> n; ){
		memset(memo, -1, sizeof memo);
		cout << rec(0, n) << endl;
	}
}