TRES - Tresnja

Lana lives in a small but merry village. There is a row of cherry trees next to the main street. Lana numbered the trees with consecutive integers starting with 1.

After much studying, Lana noticed that the number of the tree uniquely determines the amount of cherries the tree gives.

For one tree, consider consecutive groups of digits in the tree's number. For each group of digits, multiply the digit by the square of the length of the group. Adding these numbers for all groups gives the total number of cherries the tree gives.

For example, in tree number 77744007, the groups are 777, 44, 00 and 7. The amount of cherries will be 7·3^2 + 4·2^2 + 0·2^2 + 7·1^2 = 86 units.

The time has come to pick the cherry trees and the villagers have agreed to pick all trees numbered A through B (inclusive). Write a program that will calculate the total amount of cherries picked.

Input

Input consists of two integers A and B (1 ≤ A ≤ B ≤ 10^15), the first and last trees to be picked.

Output

Output a single integer, how many units of cherries will be picked.

Example

Input:
100 111

Output:
68

Được gửi lên bởi:Race with time
Ngày:2009-02-08
Thời gian chạy:0.194s
Giới hạn mã nguồn:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:Tất cả ngoại trừ: ERL GOSU JS-RHINO NODEJS PERL6 PYPY RUST SED VB.NET
Nguồn bài:COCI 2008/2009 - Contest #5, 7th February 2009

hide comments
2015-10-08 18:02:11 Nắng
best time!!!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.