MOD = 10 ** 9 + 7 N = 1000 fact = [0 for _ in range(N)] invfact = [0 for _ in range(N)] fact[0] = 1 for i in range(1, N): fact[i] = fact[i - 1] * i % MOD invfact[N - 1] = pow(fact[N - 1], MOD - 2, MOD) for i in range(N - 2, -1, -1): invfact[i] = invfact[i + 1] * (i + 1) % MOD def nCk(n, k): if k < 0 or n < k: return 0 else: return (fact[n] * invfact[k] % MOD) * invfact[n - k] % MOD def nHk(n, k): return nCk(n + k - 1, k) n = int(input()) cnt = list(map(int, input().split())) m = n times = 1 for c in cnt: times *= nCk(m, c) m -= c times %= MOD tot = 0 for i, c in enumerate(cnt, 1): tot += i * (times * pow(nCk(n, c), MOD - 2, MOD) * nCk(n - 1, c - 1)) tot %= MOD print(tot * (pow(10, n, MOD) - 1) * pow(9, MOD - 2, MOD) % MOD)