import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() C = [0]+LI() mod = 10**9+7 fac = [1,1] for i in range(2,2*10**5+1): fac.append((fac[-1]*i) % mod) a = fac[N] for i in range(1,10): a *= pow(fac[C[i]],mod-2,mod) a %= mod inv_N = pow(N,mod-2,mod) ans = 0 for i in range(1,10): ans += a * C[i] % mod * inv_N % mod * i % mod ans %= mod ans *= pow(10,N,mod)-1 ans %= mod ans *= pow(9,mod-2,mod) ans %= mod print(ans)