#include <stdio.h>

#define ull unsigned long long
#define MOD 1000000007ULL

int main() {
    int memo[100010];
    memo[0] = 1;
    ull i;
    for (i = 1ULL; i <= 100000ULL; ++i) {
        memo[i] = (int)((((ull)memo[i-1]) * i) % MOD);
    }
    int t;
    scanf("%d", &t);
    while (t--) {
        int x;
        scanf("%d", &x);
        printf("%d\n", memo[x] - 1);
    }
    return 0;
}