m = 1000000007 N, *c = map(int, open(0).read().split()) x = 1 for i in range(N - 1): x *= i + 1 x %= m result = 0 t = 1 for _ in range(N): for i in range(9): result += t * (i + 1) * x result %= m t *= 10 t %= m print(result)