Chinese Valentine's Day
题号:NC213983
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Recently, God Liu has been so absorbed in the Pac-Man game that he has even neglected his young fans.So before Chinese valentine's dayin order to have time for him to accompany the girls, while God Liu went to the bathroom, Lao Zhao hid his computer, and told him that computer had been hidden near the date place.But Lao Zhao can't tell him where the computer has been hidden.

Lao Zhao tell God Liu N numbers, the answer is the sum of all the numbers that have appeared in n numbers(mod 1e9+7).For example, in 123 there are 1,2,3,12,23,123

Gao Liu are so excited,he decides to pick up the computer after the date night.But he is too busy,sou he ask you to help him。Do you know the answer?

输入描述:

In the first line there is an positive integer N (1<=N<=1000),which means there are N numbers.

The next N line,each line is contains one number.

The digit sum of all numbers does not exceed 1000000.

输出描述:

One integer after mod 1e9+7.(An occurrence in a number is defined as the number of substrings, and repeated occurrences are counted only once)
示例1

输入

复制
3
1
12
123

输出

复制
164

说明

Of all the numbers that have ever appeared 1,2,3,12,23,123,sothe sum is 164.