#include<iostream>
#include<algorithm>
#include<complex>
using namespace std;
int main(){
	long long ans;
	int n;
	while(cin>>n){
		ans=0;
		for(int i=0;i<=n;i++){
			if(i<=2000&&n-i<=2000){
			int s1,s2;
			s1=1001-abs(1000-i);
			s2=1001-abs(1000-n+i);
			ans+=s1*s2;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}