407272: GYM102740 F Special Salads

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Special Saladstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Mateo has built a beautiful farm in Stardew Valley and now he wants to spend the rest of his days as a farmer buying salads from the villagers. Fortunately for him, Gus has introduced a bunch of new salads. There are $$$10^8$$$ different types of salads and they are creatively named 'Salad x' where $$$x$$$ is the type of the salad. Now, Gus is a little eccentric, his lucky numbers are any number which consists solely of the digits $$$3$$$ or $$$8$$$ (so $$$3$$$, $$$38$$$, $$$83$$$, and $$$88$$$ are lucky but $$$138$$$ is not). So, Gus has decided that the price of 'Salad x' is the first lucky number greater than or equal to $$$x$$$. Now, Mateo has been able to collect a lot of the salad types from other villagers but unfortunately, there is an interval of salad types that he has not been able to collect. Given the interval of salad types that Mateo is trying to buy, help calculate how much gold it will cost him to buy one of each of those types from Gus.

Input

The first line of input will contain two integers, $$$l$$$ and $$$r$$$ (the interval of types which Mateo does not have - inclusive of the ends) where $$$1 \leq l \leq r \leq 10^8$$$.

Output

Print a single integer (note this number may be large, so be sure to use appropriate types during your calculations) representing the amount of gold it will cost Mateo to buy one of each type of salad in the interval from Gus.

ExamplesInput
3 9
Output
76
Input
7 7
Output
8
Input
2 34
Output
909
Note

In the first sample, the interval is [3,9] and the cost of 'Salad 3' is $$$3$$$, 'Salad 4' is $$$8$$$, 'Salad 5' is $$$8$$$, 'Salad 6' is $$$8$$$, 'Salad 7' is $$$8$$$, 'Salad 8' is $$$8$$$, 'Salad 9' is $$$33$$$ so the total cost is $$$3 + 8 + 8 + 8 + 8 + 8 + 33 = 76$$$.

加入题单

上一题 下一题 算法标签: