MOD = 10**9+7 N = int(input()) C = [0]+list(map(int,input().split())) A = list(range(N+1)) A[0] = 1 for i in range(2,N+1): A[i] = (i*A[i-1])%MOD ans = 0 for i in range(1,9+1): ans = (ans+i*C[i])%MOD ans = (ans*(pow(10,N,MOD)-1)*pow(9*N,MOD-2,MOD))%MOD prod = A[N] for i in range(1,9+1): prod = (prod*pow(A[C[i]],MOD-2,MOD))%MOD ans = (ans*prod)%MOD print(ans)