#include <stdio.h>
#include <string.h>

const int lim = 4000;
const int li = lim/4;
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;} 
template<class _T> _T MIN(_T p1,_T p2){return (p1<p2)?p1:p2;} 
int memo[3][lim+1];

int solve(int i, int n){
    int r = 0;
    if(i < 3){
        for(int j = MAX(n-li,0); j <= n; j++){
            if(memo[i][j] < 0) memo[i][j] = solve(i+1,j);
            r += memo[i][j];
        }
    } else
        r = (n<=li)?1:0;
    return r;
}

int main(){
    int n;
    memset(memo,-1,sizeof(memo));
    while(scanf("%d",&n)>0) printf("%d\n", solve(0, n));
    return 0;
}