#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
ll fact[1000010];
ll MOD = 1e9 + 7;
void inti(ll v)
{
fact[0] = 1;
for (ll i = 1; i <= v; i++)
{
fact[i] = fact[i - 1] * i;
fact[i] %= MOD;
}
}
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);
}
ll nCr(ll n, ll r)
{
return ((((fact[n] * modInverse(fact[r])) % MOD) * modInverse(fact[n - r])) % MOD) % 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