#include <iostream>

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		long long int counter = 0;
		for (int i = 0; i <= 1000; i++) {
			for (int j = 0; j <= 1000; j++) {
				int k = i+j;
				if (k > n) {
					break;
				} else {
					int l = n-k;
					if (l <= 1000) {
						counter += l+1;
					} else if (l <= 2000) {
						counter += 2001-l;
					}
				}
			}
			if (i > n) {
				break;
			}
		}
		cout << counter << endl;
	}
	return 0;
}