#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, dp[4010] = {1};
  for (int i = 0; i < 4; i++)
    for (int j = 400; j >= 0; j--)
      for (int k = 1; k <= 1000; k++)
        if (j + k <= 4000) dp[j + k] += dp[j];
  while (cin >> n, n) cout << dp[n] << endl;
  return 0;
}
