eolymp
bolt
Try our new interface for solving problems
Problems

Sort the digits of numbers

Sort the digits of numbers

Consider the sequence of all positive integers from $a$ to $b$. Sort the digits of each number in increasing order. Find the sum of obtained numbers. \InputFile Two positive integers $a$ and $b~(a \le b \le 10^6)$. \OutputFile Print the sum of obtained numbers. \Examples Let $a = 19, b = 22$. The numbers from $a$ to $b$ are: $19, 20, 21, 22$. After sorting the digits in these numbers we get: $19, 02, 12, 22$. Their sum equals to $19 + 2 + 12 + 22 = 55$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
19 22
Output example #1
55
Author Michael Medvedev