#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll dp[2001] = {},ans[4001] = {},i,j,n;
    for(i=0;i<=1000;i++){
        for(j=0;j<=1000;j++) dp[i+j]++;
    }
    for(i=0;i<=4000;i++){
        for(j=max(i-2000,0LL);j<=min(i,2000LL);j++) ans[i] += dp[j]*dp[i-j];
    }
    while(cin >> n) cout << ans[n] << "\n";
}
