406995: GYM102672 C Spell

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Spelltime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Maleficent got upset when she could not cancel the spell cast upon Aurora because it's infinite and unbreakable. Luckily for us it's not such a big problem because in our version of the story all spells are mathematically described and can be cancelled much easier.

The spell is determined by two positive integer numbers $$$a$$$ and $$$b$$$. The process of cancelling the spell goes as follows:

  1. Multiply numbers from $$$a$$$ to $$$b$$$ inclusive
  2. Count the sum of digits of the result
  3. If the sum of digits isn't less then $$$10$$$, go to step $$$2$$$

To finish the cancellation rite, you need to say the resulting number. Please, help Maleficent to find it.

Input

The first line contains number $$$a$$$, the second  — number $$$b$$$ ($$$1 \le a \le b < 10^{100\,000}$$$). Both numbers have no leading zeros.

Output

Output the resulting number.

ExamplesInput
1
5
Output
3
Input
6
8
Output
3

加入题单

上一题 下一题 算法标签: