#include <iostream>

unsigned long long C(int n, int k)
{
	unsigned long long res = 1;
	for (int i=0; i<k; i++) res *= (unsigned long long)(n-i);
	for (int i=1; i<=k; i++) res /= (unsigned long long)i;
	return res;
}

int main()
{
	int n;
	while (std::cin >> n) {
		if (n>2000) n = 4000 - n;
		if (n<=1000) std::cout << C(n+3, 3) << std::endl;
		else std::cout << C(n+3, 3) - 4 * C(n-998, 3) << std::endl;
	}
	
	return 0;
}

