#include <iostream>
using namespace std;

int main(){
	int n;
	while( cin >> n ){
		if( n == 4000 ){
			cout << 1003003001 << endl;
			continue;
		}
		int ans = 0;
		for(int a = 0; a <= 1000; a++){
			if( n < a ) break;
			for(int b = 0; b <= 1000; b++){
				if( n < a + b ) break;
				for(int c = 0; c <= 1000; c++){
					if( n < a + b + c ) break;
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
}