Digit 8

Given L and R up to 2*10^9, find the minimum number of times digit 8 appears in any integer within [L, R].

Medium5MathGreedyStringNo attempts yetTime limit2sMemory limit512 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.