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

int main(){
	
	int n;
	int a,b,c,d;
	int count;
	
	while(cin>>n){
		count = 0;
		for(a=0;a<=n && a<=1000;++a){
			if(n-a <= 3000)
			for(b=0;b<=n-a && b<=1000;++b){
				if(n-a-b <= 2000)
				for(c=0;c<=n-a-b && c<=1000;++c){
					if(n-a-b-c <= 1000)
						count++;
				}
			}
		}
		cout << count << endl;
	}
	
}