#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  while(cin>>n){
    vector<int> A(2001),B(2001);
    REP(i,1001)REP(j,1001)A[i+j]++;
    REP(i,1001)REP(j,1001)B[i+j]++;
    int ans=0;
    REP(i,2001)if(n-i>=0&&n-i<=2000)ans+=A[i]*B[n-i];
    cout<<ans<<endl;
  }
  return 0;
}

