#include<iostream>
using namespace std;

int memo[5][5001];

int solve(int p, int n){

  if(!p && !n) return 1;
  if(!p || n < 0 || n > p*1000) return 0;
  if(memo[p][n]) return memo[p][n];
  
  int res = 0;
  for(int i=0;i<1001;i++) res += solve(p-1, n-i);

  return memo[p][n] = res;
}

int main(){

  int n;
  for(int i=0;i<4001;i++) solve(4, i);
  while(cin >> n) cout << memo[4][n] << endl;

}