{"raw_statement":[{"iden":"statement","content":"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.\n\nThe 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 <= l <= r <= 10^8$.\n\nPrint 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.\n\nIn 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$.\n\n"},{"iden":"input","content":"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 <= l <= r <= 10^8$."},{"iden":"output","content":"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."},{"iden":"examples","content":"Input3 9\nOutput76\nInput7 7\nOutput8\nInput2 34\nOutput909\n"},{"iden":"note","content":"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$."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ L $ be the set of positive integers whose decimal representations consist only of the digits $ 3 $ and $ 8 $.  \nLet $ f(x) = \\min \\{ y \\in L \\mid y \\ge x \\} $ for $ x \\in \\mathbb{Z}^+ $.\n\n**Constraints**  \nGiven integers $ l, r \\in \\mathbb{Z} $ such that $ 1 \\le l \\le r \\le 10^8 $.\n\n**Objective**  \nCompute:  \n$$\n\\sum_{x=l}^{r} f(x)\n$$","simple_statement":"Given an interval [l, r], for each salad type x in [l, r], the cost is the smallest lucky number ≥ x, where lucky numbers contain only digits 3 and 8. Sum all these costs.","has_page_source":false}