#include<cstdio>
typedef long long ll;
int n;

int main(void){
	while(~scanf("%d",&n)){
		ll cnt=0;
		for(int i=0;i<=1000;i++){
			for(int j=0;j<=1000;j++){
				if(i+j<=n){
					int d=n-i-j;
					if(d<=1000)cnt+=(ll)(d+1);
					if(d>1000 && d<=2000)cnt+=(ll)(2000-d+1);
				}
			}
		}
		printf("%lld\n",cnt);
	}
	return 0;
}