N = int(input()) C = list(map(int,input().split())) MOD = 10 ** 9 + 7 fact = [1]*(N+1) rfact = [1]*(N+1) r = 1 for i in range(1, N+1): fact[i] = r = r * i % MOD rfact[N] = r = pow(fact[N], MOD-2, MOD) for i in range(N, 0, -1): rfact[i-1] = r = r * i % MOD # nCk (mod MOD) を求める def comb(n, k): return fact[n] * rfact[k] * rfact[n-k] % MOD #組合せの個数 tn = N nc = 1 for i in range(9): nc = (nc * comb(tn,C[i])) % MOD tn -= C[i] cnt = 0 for i in range(9): cnt += ((i+1) * nc * C[i] * pow(N,MOD-2,MOD)) % MOD ans = (int("1"*N) % MOD * cnt) % MOD print(ans)