#include #include #include #include using ll = long long; constexpr ll MOD = 1000000007; int main() { int K; std::cin >> K; std::vector C(K); int G = -1, S = 0; for (int i = 0; i < K; i++) { std::cin >> C[i], G = (G == -1 ? C[i] : std::gcd(G, C[i])), S += C[i]; } std::vector f(S + 1, 1), invf(S + 1, 1); for (ll i = 2; i <= (ll)S; i++) { f[i] = (f[i - 1] * i) % MOD, invf[i] = ((MOD - MOD / i) * invf[MOD % i]) % MOD; } ll SI = invf[S]; for (int i = 2; i <= S; i++) { (invf[i] *= invf[i - 1]) %= MOD; } std::vector pc(G + 1, 0); for (int p = 1; p <= G; p++) { if (G % p != 0) { continue; } pc[p] = f[S / p]; for (int i = 0; i < K; i++) { (pc[p] *= invf[C[i] / p]) %= MOD; } } ll sum = 0; for (int i = 0; i < S; i++) { const int p = S / std::gcd(S, i); (sum += pc[p]) %= MOD; } std::cout << sum * SI % MOD << std::endl; return 0; }