#include<iostream>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  int n;
  while (cin >> n) {
    long long res = 0;
    rep (a, 1001) rep (b, 1001) if (a + b <= n) {
      int nn = n - a - b;
      if (nn <= 1000) res += nn + 1;
      else if (nn <= 2000) res += 2000 - nn + 1;
    }
    cout << res << endl;
  }
  return 0;
}