#include <cstdio>
#include <cstring>

using namespace std;

int dp[5][4444];

int solve(int a,int b)
{
  if(a*1000<b)return 0;
  if(a==0 && b==0)return dp[a][b]=1;
  if(dp[a][b]>=0)return dp[a][b];
  int res = 0;
  for(int i = 0; i <= 1000; i++) {
    if(b<i)break;
    res += solve(a-1,b-i);
  }
  return dp[a][b] = res;
}

int main(void)
{
  int n;
  memset(dp,-1,sizeof(dp));
  for(int i = 0; i <= 4000; i++) {
    solve(4,i);
  }
  while(scanf("%d",&n) == 1) {
    printf("%d\n",dp[4][n]);
  }
}