#include using namespace std; #define test() int t;scanf("%d",&t);for(int tno=1;tno<=t;tno++) #define mp make_pair #define pb push_back #define wl(n) while(n--) #define fi first #define se second #define all(c) c.begin(),c.end() typedef long long ll; typedef unsigned long long llu; typedef vector vi; typedef pair pii; typedef pair > piii ; typedef pair pll; typedef pair pli; #define sz(a) int((a).size()) #define ini(a,v) memset(a,v,sizeof(a)) #define sc(x) scanf("%d",&x) #define sc2(x,y) scanf("%d%d",&x,&y) #define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z) #define scl(x) scanf("%lld",&x) #define scl2(x,y) scanf("%lld%lld",&x,&y) #define scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z) #define scs(s) scanf("%s",s); #define gcd __gcd #define debug() printf("here\n") #define chk(a) cerr << endl << #a << " : " << a << endl #define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl #define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) #define MOD 1000000007 #define inf ((1<<29)-1) #define linf ((1LL<<60)-1) const double eps = 1e-9; //----------------------------------------------------------------------------------------------- const int MAX = 200009; char s[MAX]; ll dp[MAX][26]={0}; ll fact[MAX]; ll ivf[MAX]; ll pw(ll base ,ll expo,ll c) { if(expo == 0 ) return 1 ; ll f = pw(base , expo /2,c) ; if(expo&1) return (((f*f)%c)*base)%c ; return (f*f)%c; } int main() { int i,j,k; fact[0]=1LL; ivf[0] = pw(fact[0],MOD-2,MOD); for(ll i=1;i0){ a[i]-= dp[l-1][i]; } } ll o = 0; ll sum = 0; vectorden; for(i=0;i<26;i++){ if(a[i]){ if(a[i]&1) o++; sum += a[i]/2; if(a[i]/2) den.pb(a[i]/2); } } chk2(sum,o); ll ans = fact[sum]; for(i=0;i0){ ans = (ans*o)%MOD; } printf("%lld\n",ans); } return 0; }