#include <stdio.h>

int N(int　x){
    return (x+1)*(x+2)*(x+3)/6
}

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