#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
ll fact[1000010], inv[1000010];
ll MOD = 1e9 + 7;
ll power(ll x, ll n)
{
if (n == 0)
{
return 1;
}
ll sq = power(x, n / 2) % MOD;
sq = (sq * sq) % MOD;
if (n % 2 != 0)
{
sq *= x;
}
return sq % MOD;
}
ll modInverse(ll n)
{
return power(n, MOD - 2);
}
void inti(ll v)
{
fact[0] = 1;
for (ll i = 1; i <= v; i++)
{
fact[i] = fact[i - 1] * i;
fact[i] %= MOD;
inv[i] = modInverse(i);
}
}
ll nCr(ll n, ll r)
{
if (!r)
return 1;
ll g = fact[n];
g *= inv[r];
g %= MOD;
g *= fact[n - r];
return g % MOD;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
inti(1e6);
int t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
ll k = 0, ans = 0;
while (n >= k)
{
ans += nCr(n, k);
ans %= MOD;
n--, k++;
}
cout << ans << "\n";
}
return 0;
}
Copy