#include <bits/stdc++.h> using namespace std; typedef long long ll; ll MOD= 1e9+7; int main() { int t; cin>>t; while(t--) { ll fact=1; ll n; cin>>n; for(ll i=1;i<=n;i++) { fact=(fact*i)%MOD; } ll ans=(fact*n)%MOD; ll ans2=(ans*(n-1))%MOD; cout<<ans2<<"\n"; } return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter