#include #include #include using namespace std; typedef long long ll; const int mod=1000000007; int cas,n,i,j; ll mi[1000100],inv[1000100]; ll quickmi(ll x,ll y){ ll ans=1; while (y){ if (y&1)ans=ans*x%mod; x=x*x%mod; y>>=1; } return ans; } int main(){ scanf("%d",&cas); mi[0]=1;for (i=1;i<=1000010;i++)mi[i]=mi[i-1]*i%mod; for(inv[1]=1,i=2;i<=1000010;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod; for(inv[0]=1,i=1;i<=1000010;i++) (inv[i]*=inv[i-1])%=mod; while (cas--){ scanf("%d",&n); ll ans=0; for (i=0;i<=n>>1;i++)ans=(ans+mi[n+1]*inv[i]%mod*inv[i+1]%mod*inv[n-i*2]%mod)%mod; ans=ans*quickmi(n+1,mod-2)%mod; printf("%I64d\n",ans); } }