cho.sh
Notes
Loading...

Count Numbers Made Only of 4 and 7

Time limit

2s

Memory limit

128 MB

Problem

Call a positive integer good if every digit is either 4 or 7.

Given two positive integers A and B, count how many good integers are between A and B, inclusive.

Input

The first line contains two positive integers A and B, separated by a space.

1 <= A <= B <= 1,000,000,000

Output

Print the number of good integers between A and B, inclusive.