#include <bits/stdtr1c++.h>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef complex<ld> pt;

ll fact[100005];
const ll mod = 1000000007;
int main() {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= 100001; i++) {
		fact[i] = i*fact[i-1];
		fact[i] %= mod;
	}
	
	int t; cin >> t;
	while (t--) {
		int n; cin >> n;
		cout << (fact[n]-1+mod)%mod << endl;
	}
	
	return 0;
}