import math import functools def inv(n, mod): ''' mod を法とした n の逆元 ret を返す (n * ret) % mod = 1 となる ''' b = bin(mod-2)[2:][-1::-1] ret = 1 tmp = n % mod if b[0] == '1': ret = n % mod for bi in b[1:]: tmp *= tmp tmp %= mod if bi == '1': ret *= tmp ret %= mod return ret def init_factorials(N, mod): f = 1 fac = [1] * (N + 1) for i in range(1, N + 1): f *= i f %= mod fac[i] = f return fac def init_invfac(N, mod, fac): ret = inv(fac[N], mod) invfac = [1] * (N + 1) invfac[N] = ret for i in range(N-1, 0, -1): ret *= i + 1 ret %= mod invfac[i] = ret return invfac def read_data(): K = int(input()) Cs = list(map(int, input().split())) return K, Cs def solve(K, Cs): N = sum(Cs) mod = 10**9 + 7 fac = init_factorials(N, mod) invfac = init_invfac(N, mod, fac) div = functools.reduce(math.gcd, Cs) divs = find_divs(div) ans = calc(N, divs, Cs, fac, invfac, mod) return ans def find_divs(div): ''' div の約数(div, 1 を含む)の降順のリストを返す ''' divs_small = [] divs_large = [] t = int(div ** 0.5) for c in range(1, t + 1): if div % c: continue divs_small.append(c) divs_large.append(div // c) if t * t == div: del divs_small[-1] divs_large.extend(divs_small[::-1]) return divs_large def calc(N, divs, Cs, fac, invfac, mod): g = 0 ans = 0 for d in divs: h = fac[N//d] for c in Cs: h *= invfac[c//d] h %= mod ans += ((h - g) % mod) * inv(N//d, mod) ans %= mod g = h return ans K, Cs = read_data() print(solve(K, Cs))