The Bubble Cup hypothesis stood unsolved for 130 years. Who ever proves the hypothesis will be regarded as one of the greatest mathematicians of our time! A famous mathematician Jerry Mao managed to reduce the hypothesis to this problem:

Given a number m, how many polynomials P with coefficients in set {\{0,1,2,3,4,5,6,7\}} have: P(2)=m?

Help Jerry Mao solve the long standing problem!

Input

The first line contains a single integer t (1 ≤ t ≤ 5⋅ 10^5) - number of test cases.

On next line there are t numbers, m_i (1 ≤ m_i ≤ 10^{18}) - meaning that in case i you should solve for number m_i.

Output

For each test case i, print the answer on separate lines: number of polynomials P as described in statement such that P(2)=m_i, modulo 10^9 + 7.

Example

Input


2
2 4


Output


2
4

Note

In first case, for m=2, polynomials that satisfy the constraint are x and 2.

In second case, for m=4, polynomials that satisfy the constraint are x^2, x + 2, 2x and 4.
#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
void chkmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
void chkmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
namespace fastio {
char rbuf[1 << 23], *p1 = rbuf, *p2 = rbuf, wbuf[1 << 23], *p3 = wbuf;
inline char getc() {
  return p1 == p2 &&
                 (p2 = (p1 = rbuf) + fread(rbuf, 1, 1 << 23, stdin), p1 == p2)
             ? -1
             : *p1++;
}
inline void putc(char x) { (*p3++ = x); }
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  T neg = 0;
  while (!isdigit(c)) neg |= !(c ^ '-'), c = getchar();
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (neg) x = (~x) + 1;
}
template <typename T>
void recursive_print(T x) {
  if (!x) return;
  recursive_print(x / 10);
  putc(x % 10 + '0');
}
template <typename T>
void print(T x) {
  if (!x) putc('0');
  if (x < 0) putc('-'), x = ~x + 1;
  recursive_print(x);
}
void print_final() { fwrite(wbuf, 1, p3 - wbuf, stdout); }
}  // namespace fastio
const int MOD = 1e9 + 7;
void solve() {
  long long x;
  fastio::read(x);
  register int d0 = 1, d1 = 1, d2 = 1, d3 = 1, d4 = 0, d5 = 0, d6 = 0, d7 = 0;
  register int s0 = 1, s1 = 2, s2 = 3, s3 = 4, s4 = 4, s5 = 4, s6 = 4, s7 = 4;
  for (int i = 1; i <= 60; i++) {
    register int nd = x >> i & 1;
    nd ? (d0 = s1, d1 = s3, d2 = s5, d3 = d4 = d5 = d6 = d7 = s7)
       : (d0 = s0, d1 = s2, d2 = s4, d3 = s6, d4 = d5 = d6 = d7 = s7);
    !nd ? (((d4 -= s0) < 0) && (d4 += MOD), ((d5 -= s2) < 0) && (d5 += MOD),
           ((d6 -= s4) < 0) && (d6 += MOD), ((d7 -= s6) < 0) && (d7 += MOD))
        : (((d4 -= s1) < 0) && (d4 += MOD), ((d5 -= s3) < 0) && (d5 += MOD),
           ((d6 -= s5) < 0) && (d6 += MOD), ((d7 -= s7) < 0) && (d7 += MOD));
    s0 = d0;
    ((s1 = s0 + d1) >= MOD) && (s1 -= MOD);
    ((s2 = s1 + d2) >= MOD) && (s2 -= MOD);
    ((s3 = s2 + d3) >= MOD) && (s3 -= MOD);
    ((s4 = s3 + d4) >= MOD) && (s4 -= MOD);
    ((s5 = s4 + d5) >= MOD) && (s5 -= MOD);
    ((s6 = s5 + d6) >= MOD) && (s6 -= MOD);
    ((s7 = s6 + d7) >= MOD) && (s7 -= MOD);
  }
  fastio::print(d0);
  fastio::putc('\n');
}
int main() {
  int T;
  fastio::read(T);
  while (T--) solve();
  fastio::print_final();
  return 0;
}
