#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>K; if(K==1) return _P("1\n"); FOR(i,K) cin>>C[i], T+=C[i]; ll g=C[0]; ll tot=0; FOR(i,K) g=__gcd(g,C[i]); for(i=1;i<=g;i++) if(g%i==0) { num[i]=fact[T/i]; FOR(j,K) num[i] = num[i] * factr[C[j]/i] % mo; x=i; for(j=2;j*j<=x;j++) if(x%j==0) { num[i] -= num[j]; while(x%j==0) x/=j; } if(x>1 && x!=i) num[i] -= num[x]; num[i]=(num[i]%mo+mo)%mo; tot += num[i]/(T/i); } cout<