#include<cstdio>
#include<iostream>
int main(){
    int n;
    int abc[3001];
    abc[0]=1;
    abc[3000]=1;
    for(int i=2;i<1502;i++){
        abc[i-1]=abc[i-2]+i;
        if(1000<i-1)
            abc[i-1]-=((i-1)-1000)*3;
        abc[3000-(i-1)]=abc[i-1];
    }
    while(scanf("%d",&n)!=EOF){
        int ans=0;
        int is=n-1000;
        if(is<0)
            is=0;
        for(int i=is;i<n+1&&i<3001;i++){
            ans+=abc[i];
        }
        printf("%d\n",ans);
    }
    return 0;
}