#870
Platinum V
V
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Zvonko is playing with digits again, even though his mother has warned him that he is doing too much math and should go outside to play with his friends.

In his latest game, Zvonko looks for multiples of an integer XX, composed only of certain digits. A multiple of XX is any number divisible by XX.

In order to ruin Zvonko's fun, his mother decided to get a program that solves the problem. Write a program that calculates how many multiples of XX are between AA and BB (inclusive), such that, when written in decimal, they contain only certain allowed digits.

입력

The first line of input contains three integers XX, AA and BB (1X<10111 \le X < 10^{11}, 1AB<10111 \le A \le B < 10^{11}).

The second line contains the allowed digits. The digits will be given with no spaces, sorted in increasing order and without duplicates.

출력

Output the number of multiples Zvonko can make on a single line.

예제 입력 1

2 1 20
0123456789

예제 출력 1

10

예제 입력 2

6 100 9294
23689

예제 출력 2

111

예제 입력 3

5 4395 9999999999
12346789

예제 출력 3

0
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Platinum V1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.