#include #include #include #include using ll = long long; constexpr ll MOD = 1000000007; template class ModCombination { public: ModCombination(const std::size_t n) : fact(n + 1, 1), inv(n + 1, 1), inv_fact(n + 1, 1) { for (ll i = 2; i <= (ll)n; i++) { fact[i] = (fact[i - 1] * i) % mod, inv[i] = ((mod - (mod / i)) * inv[mod % i]) % mod, inv_fact[i] = (inv_fact[i - 1] * inv[i]) % mod; } } ll factorial(const std::size_t n) const { return fact[n]; } ll inverse(const std::size_t n) const { return inv[n]; } ll inverseFactorial(const std::size_t n) const { return inv_fact[n]; } ll permutation(const std::size_t n, const std::size_t k) const { return (fact[n] * inv_fact[n - k]) % mod; } ll combination(const std::size_t n, const std::size_t k) const { return (((fact[n] * inv_fact[k]) % mod) * inv_fact[n - k]) % mod; } private: std::vector fact, inv, inv_fact; }; 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]; } ModCombination<> mod(S); std::vector pc(G + 1, 0); for (int p = 1; p <= G; p++) { if (G % p != 0) { continue; } pc[p] = mod.factorial(S / p); for (int i = 0; i < K; i++) { (pc[p] *= mod.inverseFactorial(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 * mod.inverse(S) % MOD << std::endl; return 0; }