#include <iostream>
#include <vector>

template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

template <class T>
struct Combination {
    int max_n;
    std::vector<T> f, invf;

    explicit Combination(int n)
        : max_n(n), f(n + 1), invf(n + 1) {
        f[0] = 1;
        for (int i = 1; i <= n; ++i) {
            f[i] = f[i - 1] * i;
        }

        invf[max_n] = f[max_n].inv();
        for (int i = max_n - 1; i >= 0; --i) {
            invf[i] = invf[i + 1] * (i + 1);
        }
    }

    T fact(int n) const { return f[n]; }
    T invfact(int n) const { return invf[n]; }
    T perm(int a, int b) const {
        return a < b || b < 0 ? T(0) : f[a] * invf[a - b];
    }
    T comb(int a, int b) const {
        return a < b || b < 0 ? T(0) : f[a] * invf[a - b] * invf[b];
    }
};

template <class T>
using Vector = std::vector<T>;
template <class T>
using Matrix = Vector<Vector<T>>;

template <class T>
Matrix<T> operator*(const Matrix<T>& a, const Matrix<T>& b) {
    int n = a.size(), m = b.size(), l = b.front().size();
    Matrix<T> ret(n, Vector<T>(l, 0));

    for (int i = 0; i < n; ++i) {
        for (int k = 0; k < l; ++k) {
            for (int j = 0; j < m; ++j) {
                ret[i][k] += a[i][j] * b[j][k];
            }
        }
    }
    return ret;
}

template <class T>
Vector<T> operator*(const Matrix<T>& a, const Vector<T>& v) {
    int n = a.size(), m = v.size();
    Vector<T> ret(n, 0);

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            ret[i] += a[i][j] * v[j];
        }
    }
    return ret;
}

template <class T, class Int>
Matrix<T> mpow(Matrix<T> b, Int n) {
    Matrix<T> ret(b.size(), Vector<T>(b.size(), 0));
    for (int i = 0; i < b.size(); ++i) ret[i][i] = 1;

    while (n > 0) {
        if (n & 1) ret = ret * b;
        n >>= 1;
        b = b * b;
    }
    return ret;
}

const Combination<mint> C(10000);

mint calc(int n) {
    mint ret = 0;
    for (int k = 0; k * 2 <= n; ++k) {
        ret += C.comb(k + 4, 4) * C.comb(n - k * 2 + 10, 10);
    }
    return ret;
}

constexpr int N = 21;

Vector<mint> init(N);
Matrix<mint> mat(N, Vector<mint>(N, 0));

void build() {
    for (int i = 0; i < N; ++i) init[i] = calc(i);

    for (int i = 0; i + 1 < N; ++i) {
        mat[i][i + 1] = 1;
    }

    Vector<mint> v(N + 1, 0);
    v[0] = 1;
    for (int i = 0; i < 5; ++i) {
        for (int j = N; j - 2 >= 0; --j) {
            v[j] -= v[j - 2];
        }
    }
    for (int i = 0; i < 11; ++i) {
        for (int j = N; j - 1 >= 0; --j) {
            v[j] -= v[j - 1];
        }
    }

    v.pop_back();
    for (auto& x : v) x = -x;
    mat.back() = v;
}

void solve() {
    int n;
    std::cin >> n;

    if (n < 5) {
        std::cout << 0 << "\n";
        return;
    }

    n -= 5;

    auto v = mpow(mat, n) * init;
    std::cout << v[0] << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    build();

    int q;
    std::cin >> q;
    while (q--) solve();

    return 0;
}


Measured memory_bytes: 3740