Sakae and Kanae stayed at an inn called Izua-ya. Izua-ya has a long corridor extending from the reception desk, and along the corridor, there is a row of rooms evenly spaced. Each room is assigned a room number in descending order, starting with the room closest to the reception desk. The room numbers start from 1, and there is no overlap. However, since 4 and 9 are considered bad luck numbers in Japan, all positive integers that do not contain those numbers in any digit are used as room numbers.
Sakae and Kanae were given the numbers of the rooms they would be staying in at the reception desk. Since they were planning to go back and forth between each other's rooms, they wanted to know how many rooms they would have to travel from Sakae's room to Kanae's room.
Wreate a program that reads two room numbers in Izuya and calculates the distance required to move from one room to the other. In this case, the distance to move to one neighboring room is set to 1.
The input is given in the following format.
$p$ $q$
On a single line, Sakae's room number $p$ and Kanae's room number $q$ ($1 \leq p < q \leq 10^{100}$) are given. $p$ and $q$ are integers without 4 and 9 in any digit.
Output the distance required to move from one guest room to the other.
5 12
6
38 50
1
1 10000000000
1073741823