#include <stdio.h>
long N(int x){
  return (long)(x+1)*(x+2)*(x+3)/6;
}

int main(){
  int n;
  while(~scanf("%d",&n)){
    if (n > 2000) n = 4000 - n;
    if (n < 1001) printf("%ld\n",N(n));
    else printf("%ld\n", N(n)-(N(2*(n-1000))-n+999)/2);
  }
  return 0;
}