#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	while( cin >> n ){
		long long int ans = 0;
		for( int a = max( n - 3000, 0 ); a <= min( n, 1000 ); ++a ){
			for( int b = max( n - a - 2000, 0 ); b <= min( n - a, 1000 ); ++b ){
				int clow = max( n - a - b - 1000, 0 );
				int chigh = min( n - a - b, 1000 );
				ans += ( chigh - clow + 1 );
			}
		}
		cout << ans << endl;
	}

	return 0;
}