cho.sh
Notes
Loading...

Digit 8

Time limit

2s

Memory limit

512 MB

Problem

Two natural numbers L and R are given. Among all natural numbers greater than or equal to L and less than or equal to R, choose a number that contains the digit 8 as few times as possible. Find how many times the digit 8 appears in such a number.

Input

The first line contains L and R. L is a natural number not greater than 2,000,000,000. R is greater than or equal to L and is also not greater than 2,000,000,000.

Output

Print the minimum possible number of digit 8s among all natural numbers from L to R, inclusive.