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>
#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC optimization("O3")
using namespace std;
const unsigned long long mod = 1000000007;
const long long inf = ((1ll << 31ll) - 1ll);
const long long INF = (((1ll << 59ll) - 1ll) * 2ll) + 1ll;
const long double pi = acos(-1);
const long long MAXN = 1000000;
vector<bool> Criba(MAXN + 1);
vector<long long> primes;
void iniciar_criba() {
  for (long long i = 2; i <= MAXN; i += 2) Criba[i] = 2;
  primes.push_back(2);
  for (long long i = 3; i <= MAXN; i += 2) {
    if (!Criba[i]) {
      primes.push_back(i);
      Criba[i] = i;
      for (long long j = i * i; j <= MAXN; j += (2 * i))
        if (!Criba[j]) Criba[j] = i;
    }
  }
}
bool isprime(long long tupac) { return (Criba[tupac] == tupac); }
long long GCD(long long q, long long r) {
  if (r == 0) return q;
  return GCD(r, q % r);
}
long long LCM(long long q, long long r) { return q * (r / GCD(q, r)); }
long long qpow(long long b, long long e) {
  if (!e) return 1;
  if (e & 1) return qpow(b, e - 1) * b % mod;
  long long pwur = qpow(b, e >> 1);
  return pwur * pwur % mod;
}
long long InverM(long long a, long long b) {
  long long eso = a - (a / b) * b;
  if (eso == 0) return 0;
  long long ans = (1 - b * InverM(b, eso)) / eso;
  if (ans < 0) ans += b;
  return ans;
}
long long t, n, D, m, k, bL, bR;
void problem() {
  cin >> n;
  if (n == 1) {
    cout << 1;
    return;
  }
  n /= 2;
  n *= 2;
  n += 2;
  long long a = n;
  n /= 4;
  long long temp = n;
  n %= mod;
  n *= (n + 1);
  n /= 2;
  n--;
  n *= 2;
  n %= mod;
  n += 2;
  if (a % 4 == 2) {
    n += temp + 1;
  }
  n %= mod;
  cout << n;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(9);
  srand(time(NULL));
  cin >> t;
  while (t--) {
    problem();
    cout << '\n';
  }
  return 0;
}
