#P1141. Reverse

    ID: 142 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>湖南省第十二届大学生计算机程序设计竞赛(HNCPC2016)

Reverse

Description

Bobo has an n digits decimal number D = d1d2dn (It may have leading zeros).

Let R(i, j) denotes number D with digits between the i-th position and j-th position reversed.

That is, R(i, j) = d1di − 1djdj − 1didj + 1dj + 2dn.

Bobo would like to find

$$ \sum_{i=1}^{n}\sum_{j=i}^{n}R(i,j) $$

modulo (109 + 7).

Input

The input contains at most 30 sets. For each set:

The first line contains an integer n(1 ≤ n ≤ 105).

The second line contains n digits d1d2dn(0 ≤ di ≤ 9).

Output

For each set, an integer denotes the result.

2
12
3
012
10
0123456789
45
369
733424314