#include <iostream>
#include <math.h>
using namespace std;

int main() {
	int n;
	while (cin >> n != NULL) {
		int count = 0;
		if (n <= 4000) {
			for (int i = 0; i <= 1000 && i <= n && n <= 4000; i++) {
				if (n-i > 3000)
					continue;
				for (int j = 0; j <= 1000 && i+j <= n; j++) {
					count += n-(i+j)+1;
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}