#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int dp[5][4444];

int solve(int k,int sum){
  if(k==3) return sum>1000?0:1;
  if(k==2 && sum>2000) return 0;
  if(k==1 && sum>3000) return 0;
  if(dp[k][sum]) return dp[k][sum];

  int ret = 0;
  for(int i = 0; i <= 1000 && i <= sum; i++){
    ret += solve(k+1,sum-i);
  }
  return dp[k][sum] = ret;
}
int main(void){
  int n;
  for(int i = 0; i <= 4000; i++){
    solve(0,i);
    //cout << i << endl;
  }
  while(cin >> n){
    cout << solve(0,n) << endl;
  }
}