#include <iostream>
using namespace std;

int main(){
	int n;
	while(cin >> n){
		int a = n;
		if(n>1000) a = 1000;
		long s = 0;
		for(int i=0;i<=a;i++){
			int b = n-i;
			if(b>1000) b = 1000;
			for(int j=0;j<=b;j++){
				int c = n-i-j;
				if(c<=1000) s += c+1;
				else if(c<=2000) s += 2001-c;
			}
		}
		cout << s << endl;
	}
}