#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

use std::fmt::Display;
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
use std::str::FromStr;
pub const MOD: usize = 1000_000_007;

#[derive(Clone, Copy, PartialEq, Debug, Default)]
pub struct Mint<T>(pub T);

impl Mint<usize> {
    pub fn pow(self, exp: usize) -> Self {
        let mut exp = exp;
        let mut v = self;
        let mut ret = Mint(1);
        while exp > 0 {
            if exp & 1 == 1 {
                ret *= v;
            }
            v *= v;
            exp >>= 1;
        }
        ret
    }
    pub fn inv(self) -> Self {
        self.pow(MOD - 2)
    }
}

impl<T: Display + Copy + PartialEq> Display for Mint<T> {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl<T: FromStr + Copy + PartialEq> FromStr for Mint<T> {
    type Err = T::Err;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let v = T::from_str(s)?;
        Ok(Mint(v))
    }
}

impl Add<usize> for Mint<usize> {
    type Output = Self;
    fn add(self, rhs: usize) -> Self::Output {
        Mint((self.0 + rhs) % MOD)
    }
}

impl Add for Mint<usize> {
    type Output = Self;
    fn add(self, rhs: Self) -> Self::Output {
        self + rhs.0
    }
}

impl AddAssign<usize> for Mint<usize> {
    fn add_assign(&mut self, rhs: usize) {
        *self = *self + rhs;
    }
}

impl AddAssign for Mint<usize> {
    fn add_assign(&mut self, rhs: Self) {
        *self = *self + rhs;
    }
}

impl Sub<usize> for Mint<usize> {
    type Output = Self;
    fn sub(self, rhs: usize) -> Self::Output {
        let rhs = rhs % MOD;
        let lhs = self.0 + if self.0 < rhs { MOD } else { 0 };
        Mint(lhs - rhs)
    }
}

impl Sub for Mint<usize> {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self::Output {
        self - rhs.0
    }
}

impl SubAssign<usize> for Mint<usize> {
    fn sub_assign(&mut self, rhs: usize) {
        *self = *self - rhs
    }
}

impl SubAssign for Mint<usize> {
    fn sub_assign(&mut self, rhs: Self) {
        *self = *self - rhs
    }
}

impl Mul<usize> for Mint<usize> {
    type Output = Self;
    fn mul(self, rhs: usize) -> Self::Output {
        Mint((self.0 * rhs) % MOD)
    }
}

impl Mul for Mint<usize> {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self::Output {
        self * rhs.0
    }
}

impl MulAssign<usize> for Mint<usize> {
    fn mul_assign(&mut self, rhs: usize) {
        *self = *self * rhs;
    }
}

impl MulAssign for Mint<usize> {
    fn mul_assign(&mut self, rhs: Self) {
        *self = *self * rhs;
    }
}

impl Div<usize> for Mint<usize> {
    type Output = Self;
    fn div(self, rhs: usize) -> Self::Output {
        self * Mint(rhs).pow(MOD - 2)
    }
}

impl Div for Mint<usize> {
    type Output = Self;
    fn div(self, rhs: Self) -> Self::Output {
        self / rhs.0
    }
}

impl DivAssign<usize> for Mint<usize> {
    fn div_assign(&mut self, rhs: usize) {
        *self = *self / rhs;
    }
}
impl DivAssign for Mint<usize> {
    fn div_assign(&mut self, rhs: Self) {
        *self = *self / rhs;
    }
}

impl std::convert::Into<Mint<usize>> for usize {
    fn into(self) -> Mint<usize> {
        Mint(self)
    }
}

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn modv(a: &Vec<Mint<usize>>, m: &Vec<Mint<usize>>) -> Vec<Mint<usize>> {
    let mut ret = a.clone();
    let msi = |v: &Vec<Mint<usize>>| {
        v.iter()
            .rposition(|&x| x.0 != 0)
            .map(|x| x + 1)
            .unwrap_or(0)
    };
    let mi = msi(&m);
    let mut ai = msi(&ret);
    assert_ne!(mi, 0);
    if ai == 0 {
        return ret;
    }

    while ai >= mi {
        let d = ret[ai - 1] / m[mi - 1];
        for i in 0..mi {
            ret[i + ai - mi] -= m[i] * d;
        }
        ai = msi(&ret);
        if ai == 0 {
            break;
        }
    }
    ret
}

fn conv(a: &Vec<Mint<usize>>, b: &Vec<Mint<usize>>, m: &Vec<Mint<usize>>) -> Vec<Mint<usize>> {
    let n = a.len() + b.len();
    let mut ret = vec![0.into(); n];
    for i in 0..n {
        for j in 0..=i {
            if j < a.len() && i - j < b.len() {
                ret[i] += a[j] * b[i - j];
            }
        }
    }
    if m.len() > 0 {
        ret = modv(&ret, m);
    }
    ret
}

fn pow_conv(a: &Vec<Mint<usize>>, mut n: usize, m: &Vec<Mint<usize>>) -> Vec<Mint<usize>> {
    let mut tmp = a.clone();
    let l = a.len();
    let mut ret = vec![Mint(1)];
    ret.resize(a.len(), 0.into());
    while n > 0 {
        if (n & 1) == 1 {
            ret = conv(&ret, &tmp, m);
            ret.resize(l, 0.into());
        }
        tmp = conv(&tmp, &tmp, m);
        tmp.resize(l, 0.into());
        n >>= 1;
    }
    ret
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, t: usize);
    let k = 22;

    // a=(1-x)^16
    let mut a = vec![Mint(1), Mint(0) - 1];
    a.resize(k, 0.into());
    let a = pow_conv(&a, 16, &vec![]);

    // b=(1+x)^5
    let mut b: Vec<_> = [1, 5, 10, 10, 5, 1].iter().map(|&x| Mint(x)).collect();
    b.resize(k, 0.into());

    // c=a*b
    let mut c = conv(&a, &b, &vec![]);
    c.resize(k, 0.into());

    // p=x^5
    let mut p: Vec<_> = [0, 0, 0, 0, 0, 1].iter().map(|&x| Mint(x)).collect();
    p.resize(k, 0.into());

    // ix=x^(-1)
    let mut ix: Vec<_> = c.iter().map(|&x| Mint(0) - x).skip(1).collect();
    ix.resize(k, 0.into());

    for _ in 0..t {
        parse!(it, n: usize);
        // y=x^(-n)
        let y = pow_conv(&ix, n, &c);
        let ret = conv(&y, &p, &c);
        println!("{}", ret[0]);
    }
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2192