#include <iostream>
#include <algorithm>
int f(int x) {
	return 1 + std::min(abs(0 - x), std::abs(2000 - x));
}
int main() {
	int n;
	while (std::cin >> n) {
		int comb = 0;
		for (int i = 0; i <= 2000; ++i) {
			int x0 = i;
			int x1 = n - x0;
			if (x1 < 0) {
				continue;
			}
			if (2000 < x1) {
				continue;
			}
			comb += f(x0) * f(x1);
		}
		std::cout << comb << std::endl;
	}
	return 0;
}