#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

template <class T, class Op = multiplies<T>>
constexpr T power(T a, long long n, Op op = Op(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

template <class T> vector<T> operator-(vector<T> a) {
  for (auto&& e : a) e = -e;
  return a;
}
template <class T> vector<T>& operator+=(vector<T>& a, const vector<T>& b) {
  a.resize(max(size(a), size(b)));
  for (int i = 0; i < (int)size(b); ++i) a[i] += b[i];
  return a;
}
template <class T> vector<T> operator+(vector<T> a, const vector<T>& b) {
  return a += b;
}
template <class T> vector<T>& operator-=(vector<T>& a, const vector<T>& b) {
  a.resize(max(size(a), size(b)));
  for (int i = 0; i < (int)size(b); ++i) a[i] -= b[i];
  return a;
}
template <class T> vector<T> operator-(vector<T> a, const vector<T>& b) {
  return a -= b;
}
template <class T> vector<T>& operator<<=(vector<T>& a, size_t n) {
  return a.insert(begin(a), n, 0), a;
}
template <class T> vector<T> operator<<(vector<T> a, size_t n) {
  return a <<= n;
}
template <class T> vector<T>& operator>>=(vector<T>& a, size_t n) {
  return a.erase(begin(a), begin(a) + min(size(a), n)), a;
}
template <class T> vector<T> operator>>(vector<T> a, size_t n) {
  return a >>= n;
}
template <class T> vector<T> operator*(const vector<T>& a, const vector<T>& b) {
  if (empty(a) or empty(b)) return {};
  vector<T> res(size(a) + size(b) - 1);
  for (int i = 0; i < (int)size(a); ++i)
    for (int j = 0; j < (int)size(b); ++j) res[i + j] += a[i] * b[j];
  return res;
}
template <class T> vector<T>& operator*=(vector<T>& a, const vector<T>& b) {
  return a = a * b;
}
template <class T> vector<T> inverse(const vector<T>& a) {
  assert(not empty(a) and not (a[0] == 0));
  vector<T> b{1 / a[0]};
  while (size(b) < size(a)) {
    vector<T> x(begin(a), begin(a) + min(size(a), 2 * size(b)));
    x *= b * b;
    b.resize(2 * size(b));
    for (auto i = size(b) / 2; i < min(size(x), size(b)); ++i) b[i] = -x[i];
  }
  return {begin(b), begin(b) + size(a)};
}
template <class T> vector<T> operator/(vector<T> a, vector<T> b) {
  if (size(a) < size(b)) return {};
  reverse(begin(a), end(a)), reverse(begin(b), end(b));
  int n = size(a) - size(b) + 1;
  a.resize(n), b.resize(n);
  a *= inverse(b);
  return {rend(a) - n, rend(a)};
}
template <class T> vector<T>& operator/=(vector<T>& a, const vector<T>& b) {
  return a = a / b;
}
template <class T> vector<T> operator%(vector<T> a, const vector<T>& b) {
  if (size(a) < size(b)) return a;
  a -= a / b * b;
  return {begin(a), begin(a) + (size(b) - 1)};
}
template <class T> vector<T>& operator%=(vector<T>& a, const vector<T>& b) {
  return a = a % b;
}

template <class T> vector<T> bm(const vector<T>& a) {
  T d = 1;
  vector<T> c{1}, nc{1};
  int n = a.size(), k = 0, m = 1;
  for (int i = 0; i < n; ++i) {
    T nd = inner_product(rbegin(nc), rend(nc), begin(a) + (i - k), (T)0);
    if (nd == 0) ++m;
    else if (2 * k <= i) {
      auto t = nc;
      nc -= vector<T>{nd / d} * (c << m);
      c = t, d = nd;
      k = i + 1 - k, m = 1;
    } else {
      nc -= vector<T>{nd / d} * (c << m);
      ++m;
    }
  }
  return {rbegin(nc), rend(nc)};
}
template <class T> T guess_kth(const vector<T>& a, long long k) {
  auto c = bm(a);
  auto b = power(vector<T>{0, 1}, k, [&](const auto& l, const auto& r) {
    return l * r % c;
  });
  return inner_product(begin(b), end(b), begin(a), (T)0);
}

template <unsigned M> struct modular {
  using m = modular;
  static constexpr unsigned mod = M;
  unsigned v;
  modular(long long x = 0) : v((x %= mod) < 0 ? x + mod : x) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m b) { if ((int)(v += b.v - mod) < 0) v += mod; return *this; }
  m& operator-=(m b) { if ((int)(v -= b.v) < 0) v += mod; return *this; }
  m& operator*=(m b) { v = (uint64_t)v * b.v % mod; return *this; }
  m& operator/=(m b) { return *this *= power(b, mod - 2); }
  friend m operator+(m a, m b) { return a += b; }
  friend m operator-(m a, m b) { return a -= b; }
  friend m operator*(m a, m b) { return a *= b; }
  friend m operator/(m a, m b) { return a /= b; }
  friend bool operator==(m a, m b) { return a.v == b.v; }
};

using mint = modular<power(10, 9) + 7>;

vector<mint> fact, inv_fact, minv;
void prepare(int n) {
  fact.resize(n + 1), inv_fact.resize(n + 1), minv.resize(n + 1);
  for (int i = 0; i <= n; ++i) fact[i] = i ? fact[i - 1] * i : 1;
  inv_fact[n] = power(fact[n], mint::mod - 2);
  for (int i = n; i--; ) inv_fact[i] = (i + 1) * inv_fact[i + 1];
  for (int i = 1; i <= n; ++i) minv[i] = inv_fact[i] * fact[i - 1];
}
mint binom(int n, int k) {
  if (k < 0 or k > n) return 0;
  return fact[n] * inv_fact[k] * inv_fact[n - k];
}
template <> mint& mint::operator/=(mint b) {
  return *this *= b.v < minv.size() ? minv[b.v] : power(b, mod - 2);
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  prepare(128);
  vector<mint> a;
  for (int n = 1; n <= 100; ++n) {
    mint res;
    for (int m = 0; m <= n; ++m) {
      for (int i = 0; 2 * i + m <= n; ++i) {
        res += binom(m + 4, 9) * binom(i + 4, 4);
      }
    }
    a.push_back(res);
  }
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    --n;
    cout << guess_kth(a, n).v << '\n';
  }
}


Measured memory_bytes: 3672