#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000009;
const int INF = 100000000;
int dp[4001];
int main() {
  dp[0] = 1;
  for (int i = 0; i < (4); i++) {
    for (int j = 3000; j >= 0; j--) {
      for (int k = 0; k < (1000); k++) dp[j + k + 1] += dp[j];
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < (n); i++) {
    int x;
    cin >> x;
    cout << dp[x] << endl;
  }
  return 0;
}
