#P3754. 首都效应

首都效应

Description

Jace is the president of Alara. Like the president of country Q, due to war, he must travel by car to Yugo’s capital. The accompanying recorder Tezzeret is responsible for assessing Yugo’s true strength. His task is to count the number of houses in the cities along the way.

The cities of Yugo are already numbered. While counting, he discovered a rule: split the city number into several consecutive “digit runs” (each run consists of the same digit). For each run, multiply that digit by the square of the run’s length, then sum all these values to obtain the number of houses in that city. Example: for city 233233, the number of houses is 2×12+3×22=142\times1^2+3\times2^2=14.

Tezzeret was told to compute the total number of houses along the route (from city AA, where they enter Yugo, up to the capital city BB), but the computation is too heavy. Can you use a PC to help him solve this large-scale calculation?

Input Format

One line with two integers A,B(1AB1015)A, B(1 \le A \le B \le 10^{15}), representing the first city upon entering Yugo and the capital city, respectively.

Output Format

One line with one integer, the total number of houses.

100 111
68
233 233
14
1 9
45

Hint

In Sample 11, the total number of houses is: $1\times1^2+1\times1^2+1\times1^2+2\times1^2+1\times1^2+3\times1^2+\ldots+1\times1^2+9\times1^2+1\times2^2+1\times3^2=68$.

Translated by ChatGPT 5