Allowed Digit Multiples

Time limit1sMemory limit128 MB

Problem

You are given a positive integer X, a range [A, B], and a set of usable digits. Count how many multiples of X between A and B, inclusive, have a decimal representation whose every digit belongs to the given set.

Numbers are considered in their usual decimal representation, so leading zeroes are not allowed.

Input

The first line contains X, A, and B separated by spaces. (1 <= X <= 10^11, 1 <= A <= B <= 10^11)

The second line contains the usable digits in increasing order, with no duplicates.

Output

Print the number of multiples of X between A and B, inclusive, that are made only of the given digits.