#define CPP17
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
#ifdef CPP17
#include <variant>
#endif

#define endl codeforces

#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
using size_type = ssize_t;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

template <typename T, std::size_t Head, std::size_t... Tail> 
struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };

template <typename T, std::size_t Head> 
struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };

template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

#ifdef CPP17
template <typename T, typename F, typename... Args> 
void fill_seq(T &t, F f, Args... args) { 
    if constexpr (std::is_invocable<F, Args...>::value) { 
        t = f(args...); 
    } else { 
        for (size_type i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); 
    } 
}
#endif

template <typename T> vec<T> make_v(size_type sz) { return vec<T>(sz); }

template <typename T, typename... Tail> 
auto make_v(size_type hs, Tail&&... ts) { 
    auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); 
    return vec<decltype(v)>(hs, v); 
}

namespace init__ { 
struct InitIO { 
    InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } 
} init_io; 
}
#define CPP17


namespace utility {

template <typename T, T... Args>
constexpr std::array<T, sizeof...(Args)> 
make_array(std::integer_sequence<T, Args...>) {
    return {{ Args... }};
}

template <typename, typename>
struct tuple_concat;

template <typename... Args1, typename... Args2>
struct tuple_concat<std::tuple<Args1...>, std::tuple<Args2...>> {
    using type = std::tuple<Args1..., Args2...>;
};

template <ll... N1, ll... N2>
constexpr auto concat_integer_sequence(std::integer_sequence<ll, N1...>, std::integer_sequence<ll, N2...>) {
    return std::integer_sequence<ll, N1..., N2...>();
}

template <ll Head, ll... Tail>
struct reverse_sequence {
    using head_type = std::integer_sequence<ll, Head>;
    using tail_type = typename reverse_sequence<Tail...>::type;
    using type = decltype(concat_integer_sequence(std::declval<tail_type>(), std::declval<head_type>()));
};

template <ll Head>
struct reverse_sequence<Head> {
    using type = std::integer_sequence<ll, Head>;
};

template <ll... N>
constexpr auto reverse_ns(std::integer_sequence<ll, N...>) {
    return typename reverse_sequence<N...>::type();
}

}

namespace math {

template <typename T>
constexpr T pow(const T &n, ll k) {
    T ret = n.mul_id_ele();
    T cur = n;
    while (k) {
        if (k & 1) ret *= cur;
        cur *= cur;
        k /= 2;
    }
    return ret;
}

}

namespace math {

template <ll Mod>
struct Modint {

    constexpr Modint(ll x) noexcept : x((Mod + x % Mod) % Mod) { }
    
    constexpr Modint() noexcept : Modint(0) { }
    
    constexpr Modint<Mod> add_id_ele() const noexcept { 
        return Modint<Mod>(0); 
    }
    
    constexpr Modint<Mod> mul_id_ele() const noexcept {
        return Modint<Mod>(1); 
    }
    
    constexpr ll& value() noexcept { 
        return x; 
    }
    
    constexpr ll value() const noexcept {
        return x; 
    }

    constexpr Modint& operator +=(const Modint &oth) noexcept {
        x += oth.value();
        if (Mod <= x) x -= Mod;
        return *this;
    }

    constexpr Modint& operator -=(const Modint &oth) noexcept {
        x += Mod - oth.value();
        if (Mod <= x) x -= Mod;
        return *this;
    }

    constexpr Modint& operator *=(const Modint &oth) noexcept {
        x *= oth.value();
        x %= Mod;
        return *this;
    }

    constexpr Modint& operator /=(const Modint &oth) noexcept {
        x *= oth.inv().value();
        x %= Mod;
        return *this;
    }

    constexpr Modint operator +(const Modint &oth) const noexcept {
        return Modint(x) += oth;
    }

    constexpr Modint operator -(const Modint &oth) const noexcept {
        return Modint(x) -= oth;
    }

    constexpr Modint operator *(const Modint &oth) const noexcept {
        return Modint(x) *= oth;
    }

    constexpr Modint operator /(const Modint &oth) const noexcept {
        return Modint(x) /= oth;
    }

    constexpr Modint operator -() const noexcept {
        return Modint((x != 0) * (Mod - x)); 
    }

    constexpr bool operator ==(const Modint &oth) const noexcept {
        return value() == oth.value();
    }

    template <typename T>
    constexpr typename std::enable_if<std::is_integral<T>::value, const Modint&>::type
    operator =(T t) noexcept {
        (*this) = Modint(std::forward<T>(t)); 
        return *this;
    }

    constexpr Modint inv() const noexcept {
        return ::math::pow(*this, Mod - 2);
    }

    constexpr ll mod() const noexcept {
        return Mod;
    }

private:
    ll x;
};

template <ll Mod>
std::ostream& operator <<(std::ostream &os, Modint<Mod> m) {
    os << m.value();
    return os;
}

}

namespace math {

namespace ntt_helper {

template <ll Mod>
constexpr bool is_primitive_root(ll r) {
    Modint<Mod> mr(r);
    for (ll d = 2; d * d <= Mod; d++) {
        if ((Mod - 1) % d == 0) {
            if (pow(mr, d).value() == 1) return false;
            if (pow(mr, (Mod - 1) / d).value() == 1) return false;
        }
    }
    return true;
}

template <ll Mod>
constexpr ll find_primitive_root(ll r) {
    return (is_primitive_root<Mod>(r) ? r : find_primitive_root<Mod>(r + 1));
}

template <ll Mod>
constexpr ll find_primitive_root() {
    return find_primitive_root<Mod>(2);
}

constexpr auto calc_max_base(ll m) {
    ll ret = 0;
    for (; m % 2 == 0; ret++, m /= 2);
    return ret;
}

}

template <typename T>
struct convolution {
    template <typename InputIterator1, typename InputIterator2, typename OutputIterator>
    void multiply(InputIterator1 begin1, InputIterator1 end1,
                  InputIterator2 begin2, InputIterator2 end2,
                  OutputIterator out)
    {
        static_cast<T*>(this)->multiply(begin1, end1, begin2, end2, out);
    }
};

template <ll Mod, ll PrimitiveRoot>
struct ntt__ : convolution<ntt__<Mod, PrimitiveRoot>> {
    using mint = Modint<Mod>;

    constexpr ntt__() 
        :  root_lis(max_size_log), 
           iroot_lis(max_size_log)
    {
        for (size_type i = 0; i < root_lis.size(); i++) {
            root_lis[i] = pow(mint(PrimitiveRoot), (Mod - 1) >> (i + 2)) * -1;
            iroot_lis[i] = root_lis[i].inv();
        }
    }
    
    template <typename InputIterator1, typename InputIterator2>
    auto multiply(InputIterator1 begin1, InputIterator1 end1,
                  InputIterator2 begin2, InputIterator2 end2) 
    {
        size_type n = std::distance(begin1, end1);
        size_type m = std::distance(begin2, end2);
        size_type sz = 1;
        while (sz < n + m - 1) sz *= 2;
        resize_buf(sz);
        std::fill(buf[0].begin(), buf[0].begin() + sz, mint(0));
        std::fill(buf[1].begin(), buf[1].begin() + sz, mint(0));
        std::copy(begin1, end1, buf[0].begin());
        std::copy(begin2, end2, buf[1].begin());
        ntt(ALL(buf[0]), sz, false);
        ntt(ALL(buf[1]), sz, false);
        auto isz = mint(sz).inv();
        for (size_type i = 0; i < sz; i++) buf[0][i] *= buf[1][i] * isz;
        ntt(ALL(buf[0]), sz, true);
        return buf[0];
    }

    template <typename InputIterator1, typename InputIterator2, typename OutputIterator>
    void multiply(InputIterator1 begin1, InputIterator1 end1,
                  InputIterator2 begin2, InputIterator2 end2,
                  OutputIterator out)
    {
        size_type n = std::distance(begin1, end1);
        size_type m = std::distance(begin2, end2);
        multiply(begin1, end1, begin2, end2);
        std::copy(buf[0].begin(), buf[0].begin() + (n + m - 1), out);
    }

    auto get_last() {
        return buf[0].begin();
    }

    void resize_buf(size_type sz) {
        if (buf[0].size() < sz) {
            buf[0].resize(sz); 
            buf[1].resize(sz);
        }
    }

private:
    static constexpr size_type max_size_log = ntt_helper::calc_max_base(Mod - 1);
    static constexpr size_type max_size = 1ll << max_size_log;
    static constexpr size_type max_conv_size = max_size * 2;

    vec<mint> root_lis, iroot_lis;
    // std::array<mint, max_conv_size> buf[2];
    // using buf_iterator = typename std::array<mint, max_conv_size>::iterator;
    vec<mint> buf[2];
    using buf_iterator = typename vec<mint>::iterator;

    void ntt(buf_iterator begin, buf_iterator end, size_type sz, bool inv) {
        if (!inv) {
            for (int m = sz / 2; m; m /= 2) {
                mint mul = 1;
                for(int s = 0, k = 0; s < sz; s += 2 * m) {
                    for(int i = s, j = s + m; i < s + m; ++i, ++j) {
                        auto x = *(begin + i), y = *(begin + j) * mul;
                        *(begin + i) = x + y;
                        *(begin + j) = x - y;
                    }
                    mul *= root_lis[__builtin_ctz(++k)];
                }
            }
        } else {
            for (int m = 1; m < sz; m *= 2) {
                mint mul = 1;
                for (int s = 0, k = 0; s < sz; s += 2 * m) {
                    for (int i = s, j = s + m; i < s + m; i++, j++) {
                        auto l = *(begin + i), r = *(begin + j);
                        *(begin + i) = l + r;
                        *(begin + j) = (l - r) * mul;
                    }
                    mul *= iroot_lis[__builtin_ctz(++k)];
                }
            }
        }
    }
};

template <ll Mod>
using NTT = ntt__<Mod, ntt_helper::find_primitive_root<Mod>()>;

}

namespace math {

template <typename T, typename Convolution>
struct FPS : vec<T> {
    
    using value_type = T;
    using vec<T>::vec;

    static Convolution** get_conv() {
        static Convolution *conv = nullptr;
        return &conv;
    }

    static void set_conv(Convolution *conv) {
        *(get_conv()) = conv;
    }

    FPS& operator +=(const FPS &rhs) {
        if (this->size() < rhs.size()) resize(rhs.size());
        for (size_type i = 0; i < this->size(); i++) (*this)[i] += rhs[i];
        return *this;
    }

    FPS& operator -=(const FPS &rhs) {
        if (this->size() < rhs.size()) resize(rhs.size());
        for (size_type i = 0; i < this->size(); i++) (*this)[i] -= rhs[i];
        return *this;
    }

    FPS& operator *=(const FPS &rhs) {
        const size_type sz = this->size() + rhs.size() - 1;
        FPS tmp(sz);
        (*get_conv())->multiply(ALL((*this)), ALL(rhs), tmp.begin());
        return (*this) = std::move(tmp);
    }

    FPS operator +(const FPS &rhs) const {
        return FPS(*this) += rhs;
    }

    FPS operator -(const FPS &rhs) const {
        return FPS(*this) -= rhs;
    }

    FPS operator *(const FPS &rhs) const {
        return FPS(*this) *= rhs;
    }
};

// http://q.c.titech.ac.jp/docs/progs/polynomial_division.html
// [x^N](P/Q)
template <typename FPS>
auto coef_of_div(FPS P, FPS Q, size_type N) {
    assert(Q[0] == 1);
    assert(P.size() + 1 == Q.size());

    for (; N; N /= 2) {
        FPS Qn = Q;
        for (size_type i = 1; i < Q.size(); i += 2) Qn[i] *= -1;
        auto PQ = P * Qn;
        auto QQ = Q * Qn;
        for (size_type i = 0, offset = N % 2; i < P.size(); i++) P[i] = PQ[2 * i + offset];
        for (size_type i = 0; i < Q.size(); i++) Q[i] = QQ[2 * i];
    }

    return P[0];
}

}

namespace math {

template <ll Mod, ll... Mods>
ll garner(const std::array<ll, sizeof...(Mods)> &mr_) {
    constexpr size_type sz = sizeof...(Mods) + 1;
    std::array<ll, sz> mr;
    std::array<ll, sz> mods = {{ Mods..., Mod }};
    std::copy(ALL(mr_), mr.begin());
    mr.back() = 0;
    
    std::array<ll, sz> coffs, cnsts;
    std::fill(ALL(coffs), 1);
    std::fill(ALL(cnsts), 0);

    auto add = [](ll a, ll b, ll mod) {
        return (a + b + mod) % mod;
    };

    auto mul = [](ll a, ll b, ll mod) {
        return a * b % mod;
    };

    auto mod_pow = [&](ll n, ll k, ll mod) {
        ll ret = 1, cur = n;
        while (k) {
            if (k & 1) ret = mul(ret, cur, mod);
            cur = mul(cur, cur, mod);
            k /= 2;
        }
        return ret;
    };

    auto mod_inv = [&](ll n, ll mod) {
        return mod_pow(n, mod - 2, mod);
    };

    for (size_type i = 0; i < sz - 1; i++) {
        const ll v = mul(add(mr[i], mods[i] - cnsts[i], mods[i]), 
                         mod_inv(coffs[i], mods[i]),
                         mods[i]);

        for (size_type j = i + 1; j < sz; j++) {
            cnsts[j] = add(cnsts[j],
                           mul(coffs[j], v, mods[j]),
                           mods[j]);
            coffs[j] = mul(coffs[j],
                           mods[i],
                           mods[j]);
                           
        }
	}

    return cnsts.back();
}

}

template <ll Mod>
struct SimpleConvolution : math::convolution<SimpleConvolution<Mod>> {
    template <typename InputIterator1, typename InputIterator2, typename OutputIterator>
    void multiply(InputIterator1 begin1, InputIterator1 end1,
                  InputIterator2 begin2, InputIterator2 end2,
                  OutputIterator out)
    {
        size_type n = std::distance(begin1, end1),
                  m = std::distance(begin2, end2);
        size_type sz = n + m - 1;
        std::fill(out, out + sz, 0);
        for (size_type i = 0; i < n; i++) for (size_type j = 0; j < m; j++) {
            auto v1 = *(begin1 + i), v2 = *(begin2 + j);
            *(out + i + j) += v1 * v2;
        }
    }
};

template <ll Mod>
struct Solver {
    using mint = math::Modint<Mod>;
    using FPS = math::FPS<mint, SimpleConvolution<Mod>>;
    FPS num, den;
    SimpleConvolution<Mod> conv;

    // x^5 / ((1-x)^11 * (1-x^2)^5)
    Solver() {
        FPS::set_conv(&conv);
        den = FPS { 1 };
        FPS e1 = { 1, -1 }, e2 = { 1, 0, -1 };
        for (ll i = 0; i < 11; i++) den *= e1;
        for (ll i = 0; i < 5; i++) den *= e2;
        num = FPS(den.size() - 1);
        num[5] = 1;
    }

    mint solve(ll n) {
        return math::coef_of_div(num, den, n);
    }
};

constexpr ll mod = 1e9 + 7;
using mint = math::Modint<mod>;
Solver<mod> solver;

mint solve() {
    ll n;
    std::cin >> n;
    if (n < 5) return mint(0);

    return solver.solve(n);
}

int main() {
    ll t;
    std::cin >> t;
    while (t--) std::cout << solve() << "\n";
    return 0;
}


Measured memory_bytes: 3588