#include <stdio.h>
#include <unordered_map>
using namespace std;
unordered_map<int,int> m;
int get(int n){
    if(n>1000)n=2000-n;
    return n+1;
}
int solve(int n){
    int ans=0;
    for(int l=0;l<=2000;l++)if(n-l>=0&&n-l<=2000)ans+=get(n-l)*get(l);
    return ans;
}
int main(){
    int n;
    while(scanf("%d",&n)!=EOF)printf("%d\n",solve(n));
}
