#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n;
    int ab[2010] = {0};
    int ad[4010] = {0};

    for(int a = 0;a <= 1000;a++){
        for(int b = 0;b <= 1000;b++){
            ab[a+b]++;
        }
    }


    for(int a = 0;a <= 2000;a++){
        for(int b = 0;b <= 2000;b++){
            ad[a+b]+=ab[a]*ab[b];
        }
    }
     while(cin>>n){
        cout<<ad[n]<<endl;
     }
    return 0;
}