#include <bits/stdc++.h>
using namespace std;
const int INFTY = 1 << 29;
const double EPS = 1e-9;
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << '(' << p.first << ',' << p.second << ')';
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& a) {
  os << '[';
  for (int i = int(0); i < int(a.size()); i++) os << (i ? " " : "") << a[i];
  return os << ']';
}
int main() {
  vector<long long> a(2001);
  for (int i = int(0); i < int(1001); i++)
    for (int j = int(0); j < int(1001); j++) a[i + j]++;
  vector<long long> b(4001);
  for (int i = int(0); i < int(2001); i++)
    for (int j = int(0); j < int(2001); j++) b[i + j] += a[i] * a[j];
  for (int n; cin >> n && n;) cout << b[n] << endl;
  return 0;
}
