1141 : Reverse

时间限制Time Limit 1 Sec 内存限制Memory Limit 128 MB 提交次数Submitted 3 Times 通过次数Solved 2 Times 标准评测Standard Judge

题目描述Description

Bobo has an n digits decimal number D=d_{1} d_{2}…d_{n} (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)=d_{1}…d_{i-1} d_{j} d_{j-1}…d_{i} d_{j+1} d_{j+2}…d_{n}.

Bobo would like to find

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

modulo (10^{9}+7).

输入格式Input

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

The first line contains an integer n (1\leq n\leq 10^{5}).

The second line contains n digits d_{1} d_{2}…d_{n} (0\leq d_{i}\leq 9).

输出格式Output

For each set, an integer denotes the result.

样例Sample

出题Author

ftiasch

来源Source

湖南省第十二届大学生计算机程序设计竞赛(HNCPC2016)