#include <iostream>

using namespace std;
typedef long long int lint;

void answer()
{
	int dp[8][4096] = { 0 };
	dp[0][0] = 1;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j <= 4000; j++) {
			dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j] - ((j > 1000) ? dp[i][j - 1001] : 0);
		}
	}

	int n;
	while (cin >> n) {
		cout << dp[4][n] << endl;
	}
}

int main()
{
	answer();
	return 0;
}