New tickets were introduced in Yekaterinburg trams. Their numbers don't have
leading zeroes; they just go one after another, starting from number one. Some
passengers were embarrassed at hearing this news: now they didn't know how to
determine whether a ticket was lucky. New versions of the luckiness criterion
were discussed in trams, at tram stops, and, of course, at the tram forum on
the Web. According to one of the versions, a ticket was considered lucky if no
two opposite digits of its number coincided; i.e., di
≠ dn+1−i for i
≠ n + 1 − i, where
d1d2…dn was
the number of the ticket.
One of the addicts of the tram forum was a programmer, and he decided to
calculate the amount of lucky tickets in a conductor's roll if the number of
the first ticket in the roll was a, and the number of the last ticket
was b; the tickets in the roll are numbered consecutively.
Input
The input line contains the integers a and
b separated by a space (1 ≤ a ≤ b ≤
1018).
Output
Output the amount of lucky tickets in the roll.
Samples
input | output |
---|
1 10
| 10
|
100 2000
| 1620
|
Problem Author: Sergey Pupyrev
Problem Source: The 12th Urals Collegiate Programing Championship, March 29, 2008