Files
PAT/html/t1018.html
T

19 lines
968 B
HTML

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h1>1018. Subnumbers (35)</h1>
<div id="problemContent">
<p>Given a positive integer N, let us define a "subnumber" of N as a consecutive number of digits <b>NOT starting with 0</b>. For example if N = 1021, it has 7 subnumbers, namely, 1, 10, 102, 1021, 2, 21 and 1 (again). Here is your task: please calculate the sum of all the subnumbers of N. For 1021, the sum is 1+10+102+1021+2+21+1 = 1158. Since the result may be very large, output the answer modulo 1000000007 (10<sup>9</sup> + 7) please.</p>
<p><b>
Input Specification:
</b></p>
<p>Each input file contains one test case, which gives the integer N (0 &lt; N &lt; 10<sup>100000</sup>) in a line.</p>
<p><b>
Output Specification:
</b></p>
<p>Print in a line the sum of all N's subnumbers (modulo 1000000007).</p>
<b>Sample Input:</b><pre>
1234567890123456789</pre>
<b>Sample Output:</b><pre>
332876913
</pre>
</div>