#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	while(cin>>n){
	    int sum=0;
	    for(int i=0;i<=(n,1000);i++){
		    for(int j=0;j<=min(n,1000);j++){
			    if(i+j<=min(n,2000)){
    				int k=n-i-j;
	    			k=min(k,2000-k);
		    		sum+=k+1;
    			}
    		}
    	}
	    cout<<sum<<endl;
	}
	return 0;
}