#include <iostream>
using namespace std;
const int mod=1e9+7;
const int N=1e6;
long long a[N];

void f(){
    a[0]=1;
    for(int i=1;i<N;i++){
        a[i]=a[i-1] *i %mod;
    }
}
int main() {
    f();
    int t;cin>>t;
    while(t--){
        int n;cin>>n;
        cout<<a[n]<<endl;
    }
}
// 64 位输出请用 printf("%lld")