n = int(input()) c = list(map(int,input().split())) a = 0 mod = 10 ** 9 + 7 def fa(n,mod): a = 1 for i in range(n): a *= i + 1 a %= mod return a for i in range(9): a += (i + 1) * c[i] s = fa(n,mod) for i in range(9): s //= fa(c[i],mod) s %= mod t = int("1" * n) print((s * a // n * t) % mod)