typedef long long ll;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstdio>
#include <set>
#include <iostream>

using namespace std;

int main(){
  vector<vector<ll> > dp(5, vector<ll>(4000 + 1));
  dp[0][0] = 1;

  REP(i,4) REP(j,4000 + 1) if(dp[i][j]){
    for(int k = 0; k <= 1000 && j + k <= 4000; k++){
      dp[i + 1][j + k] += dp[i][j];
    }
  }

  int s;
  while(cin >> s)
    cout << dp[4][s] << endl;

  return 0;
}