#include<bits/stdc++.h>
#define mariom ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(0)
#define endl "\n"
#define ll long long
#define pi 3.14159265358979323846
using namespace std;
bool pr(int n){
if(n<=1)
return false;
for(int i=2;i*i<=n;i++){
if(n%i==0)
return false;
}
return true;
}
/*ll fact(ll n ){
ll m=1e9+7;
if (n<=1)
return 1;
else
return (n*fact(n-1))%m;
}*/
ll nCr(ll n, ll r) {
ll m=1e9+7;
if (r > n)
return 0;
if (r == 0 || r == n)
return 1;
return (nCr(n - 1, r - 1) + nCr(n - 1, r));
}
int main() {
mariom;
int t;
cin>>t;
ll m=1e9+7;
while(t--){
ll n ;
cin>>n;
ll c=0;
vector<ll>v;
for(int i=2;i<=n;i++){
if(pr(i)==true)
v.push_back(i);
}
for(int i=v[0];i<=v[v.size()-1];i++){
c+=(nCr(n,i));
}
cout<<c%m<<endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBtYXJpb20gaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSksY2luLnRpZShOVUxMKSxjb3V0LnRpZSgwKQojZGVmaW5lIGVuZGwgIlxuIgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIHBpIDMuMTQxNTkyNjUzNTg5NzkzMjM4NDYKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKYm9vbCBwcihpbnQgbil7CiAgaWYobjw9MSkKICByZXR1cm4gZmFsc2U7CiAgZm9yKGludCBpPTI7aSppPD1uO2krKyl7CiAgICBpZihuJWk9PTApCiAgICByZXR1cm4gZmFsc2U7CiAgfQogIHJldHVybiB0cnVlOwp9Ci8qbGwgZmFjdChsbCBuICl7CiAgbGwgbT0xZTkrNzsKaWYgKG48PTEpCiAgICAgICAgcmV0dXJuIDE7CiAgICBlbHNlCiAgICAgICAgcmV0dXJuIChuKmZhY3Qobi0xKSklbTsKfSovCmxsIG5DcihsbCBuLCBsbCByKSB7CiAgbGwgbT0xZTkrNzsKICAgIGlmIChyID4gbikKICAgICAgICByZXR1cm4gMDsKICAgIGlmIChyID09IDAgfHwgciA9PSBuKQogICAgICAgIHJldHVybiAxOwogICAgcmV0dXJuIChuQ3IobiAtIDEsIHIgLSAxKSArIG5DcihuIC0gMSwgcikpOwp9CgppbnQgbWFpbigpIHsKICAgbWFyaW9tOwogICAgIGludCB0OwogICAgIGNpbj4+dDsKICAgICBsbCBtPTFlOSs3OwogICAgIHdoaWxlKHQtLSl7CiAgICAgIGxsIG4gOwogICAgICBjaW4+Pm47CiAgICAgIGxsIGM9MDsKICAgICAgdmVjdG9yPGxsPnY7CiAgICAgIGZvcihpbnQgaT0yO2k8PW47aSsrKXsKICAgICAgICBpZihwcihpKT09dHJ1ZSkKICAgICAgICAgIHYucHVzaF9iYWNrKGkpOwogICAgICAgIH0KICAgICAgICBmb3IoaW50IGk9dlswXTtpPD12W3Yuc2l6ZSgpLTFdO2krKyl7CiAgICAgICAgIGMrPShuQ3IobixpKSk7CiAgICAgICAgfQogICAgICBjb3V0PDxjJW08PGVuZGw7CiAgICAgfQogICAgcmV0dXJuIDA7Cn0=