#include <iostream>
using i64 = long long;
template<i64 M> struct modint { i64 a;
  constexpr modint(const i64 x = 0): a((x%M+M)%M){}
  constexpr i64 value() const { return a; }
  constexpr modint inv() const { return this->pow(M-2); }
  constexpr modint pow(i64 r) const {
    modint ans(1); modint aa = *this;
    while(r) { if(r & 1) ans *= aa; aa *= aa; r >>= 1; }
    return ans;
  }
  constexpr modint& operator=(const i64 r) { a = (r % M + M) % M; return *this; }
  constexpr modint& operator+=(const modint r) { a += r.a; if(a >= M) a -= M; return *this; }
  constexpr modint& operator-=(const modint r) { a -= r.a; if(a < 0) a += M; return *this; }
  constexpr modint& operator*=(const modint r) { a = a * r.a % M; return *this; }
  constexpr modint& operator/=(const modint r) { (*this) *= r.inv(); return *this; }
  constexpr modint operator+(const modint r) const { return modint(*this) += r; }
  constexpr modint operator-(const modint r) const { return modint(*this) -= r; }
  constexpr modint operator*(const modint r) const { return modint(*this) *= r; }
  constexpr modint operator/(const modint r) const { return modint(*this) /= r; }
  constexpr bool operator!=(const modint r) const { return this->value() != r.value(); }
};

template<const i64 M> std::ostream& operator<<(std::ostream& os, const modint<M>& m) { os << m.value(); return os; }

#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)

template<class T>
struct matrix {
  int N, M;
  vector<vector<T>> mat;
  matrix(int N, int M, T init = T()): N(N), M(M), mat(N, vector<T>(M, init)) {}
  vector<T>& operator[](i64 i) { return mat[i]; }
  const vector<T>& operator[](i64 i) const { return mat[i]; }
  static matrix<T> E(int N) {
    matrix<T> mat(N, N, 0);
    rep(i,0,N) mat[i][i] = 1;
    return mat;
  }
};
template<class T>
matrix<T> operator*(const matrix<T>& lm, const matrix<T>& rm) {
  matrix<T> ret(lm.N, rm.M);
  rep(i, 0, lm.N) rep(j, 0, lm.M) rep(k, 0, rm.M) (ret[i][k] += lm[i][j] * rm[j][k]);
  return ret;
}
 
template<class T>
matrix<T> matrix_pow(matrix<T> mat, i64 r) {
  matrix<T> ret = matrix<T>::E(mat.N);
  while(r > 0) {
    if(r & 1) ret = ret * mat;
    mat = mat * mat;
    r >>= 1;
  }
  return ret;
}

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define STRINGIFY(n) #n
#define TOSTRING(n) STRINGIFY(n)
#define PREFIX "#" TOSTRING(__LINE__) "| "
#define debug(x) \
{ \
  std::cout << PREFIX << #x << " = " << x << std::endl; \
}

std::ostream& output_indent(std::ostream& os, int ind) {
  for(int i = 0; i < ind; i++) os << " ";
  return os;
}

template<class S, class T> std::ostream& operator<<(std::ostream& os, const std::pair<S, T>& p);
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v);

template<class S, class T> std::ostream& operator<<(std::ostream& os, const std::pair<S, T>& p) {
  return (os << "(" << p.first << ", " << p.second << ")");
}
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  os << "[";
  for(int i = 0;i < v.size();i++) os << v[i] << ", ";
  return (os << "]");
}

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  i64 T;
  cin >> T;
  using fp = modint<(i64)(1e9 + 7)>;
  matrix<fp> mat(32, 32);

  rep(i,0,16) {
    mat[i * 2][i * 2 + 1] = fp(1);
    mat[i * 2 + 1][i * 2] = fp(1);
  }
  rep(i,1,6) {
    mat[(i - 1) * 2][i * 2] = fp(1);
  }
  rep(i,6,16) {
    mat[(i - 1) * 2][i * 2] = fp(1);
    mat[(i - 1) * 2 + 1][i * 2] = fp(1);
  }
  matrix<fp> f(1, 32);
  f[0][0] = fp(1);
  while(T--) {
    i64 N;
    cin >> N;
    auto res = f * matrix_pow(mat, N + 10);
    cout << res[0][30] + res[0][31] << endl;
  }
}


Measured memory_bytes: 3564