#include<iostream>

using namespace std;


int main(){
  int a,b,c,d,n,count=0;
  int cAndD[2001];
  
  for(int j = 0; j<2001;j++){
    cAndD[j] = 0;
  }
  
  for(c = 0; c <= 1000; c++){
    for(d = 0; d <= 1000; d++){
      cAndD[c+d]++;
    }
  }
  
  
  while(cin >> n){

      if(n > 2000){
	n = n - 2000;
	n = 2000 - n;
      }
      
      for(a = 0; a <= 1000; a++){
	if(a > n)break;
	for(b = 0; b <= 1000; b++){
	  if(a + b >n) break;
	  if((n-a-b) > 2000 || (n-a-b) < 0)break;
	  count += cAndD[n-(a+b)];
	}
      }
      cout << count << endl;
      count = 0;
  }

}