628_D. Magic Numbers
Consider the decimal presentation of an integer. Let's call a number d-magic if digit d appears in decimal presentation of the number on even positions and nowhere else.

For example, the numbers 1727374, 17, 1 are 7-magic but 77, 7, 123, 34, 71 are not 7-magic. On the other hand the number 7 is 0-magic, 123 is 2-magic, 34 is 4-magic and 71 is 1-magic.

Find the number of d-magic numbers in the segment [a, b] that are multiple of m. Because the answer can be very huge you should only find its value modulo 109 + 7 (so you should find the remainder after dividing by 109 + 7).

Input

The first line contains two integers m, d (1 ≤ m ≤ 2000, 0 ≤ d ≤ 9) — the parameters from the problem statement.

The second line contains positive integer a in decimal presentation (without leading zeroes).

The third line contains positive integer b in decimal presentation (without leading zeroes).

It is guaranteed that a ≤ b, the number of digits in a and b are the same and don't exceed 2000.

Output

Print the only integer a — the remainder after dividing by 109 + 7 of the number of d-magic numbers in segment [a, b] that are multiple of m.

Examples

Input

2 6
10
99


Output

8


Input

2 0
1
9


Output

4


Input

19 7
1000
9999


Output

6

Note

The numbers from the answer of the first example are 16, 26, 36, 46, 56, 76, 86 and 96.

The numbers from the answer of the second example are 2, 4, 6 and 8.

The numbers from the answer of the third example are 1767, 2717, 5757, 6707, 8797 and 9747.
```python
# by the authority of GOD     author: manhar singh sachdev #

import os,sys
from io import BytesIO,IOBase
from array import array

def solve(x,m,d,mod,par):
    dp = [[array('i',[0])*m for _ in range(2)] for _ in range(len(x))]
    # remainder of number formed till now ; smaller/equal ; place value
    zz = int(x[0])
    for _ in range(1,zz):
        if _ == d:
            continue
        dp[0][0][_%m] += 1
    if zz != d:
        dp[0][1][zz%m] = 1
    for i in range(1,len(x)):
        zz = int(x[i])
        if i&1:
            for j in range(m):
                z = (j*10+d)%m
                dp[i][0][z] = (dp[i][0][z]+dp[i-1][0][j]+
                               (0 if d >= zz else dp[i-1][1][j]))%mod
                dp[i][1][z] = (dp[i][1][z]+(0 if d != zz else dp[i-1][1][j]))%mod
        else:
            for j in range(m):
                for k in range(10):
                    if k==d:
                        continue
                    z = (j*10+k)%m
                    dp[i][0][z] = (dp[i][0][z]+dp[i-1][0][j]+
                                   (0 if k>=zz else dp[i-1][1][j]))%mod
                    dp[i][1][z] = (dp[i][1][z]+(0 if k!=zz else dp[i-1][1][j]))%mod
    if par:
        return (dp[len(x)-1][0][0]+dp[len(x)-1][1][0])%mod
    return dp[len(x)-1][0][0]

def main():
    m,d = map(int,input().split())
    a = input().strip()
    b = input().strip()
    print((solve(b,m,d,10**9+7,1)-solve(a,m,d,10**9+7,0))%(10**9+7))

# Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self,file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd,max(os.fstat(self._fd).st_size,BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0,2),self.buffer.write(b),self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd,max(os.fstat(self._fd).st_size,BUFSIZE))
            self.newlines = b.count(b"\n")+(not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0,2),self.buffer.write(b),self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd,self.buffer.getvalue())
            self.buffer.truncate(0),self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self,file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s:self.buffer.write(s.encode("ascii"))
        self.read = lambda:self.buffer.read().decode("ascii")
        self.readline = lambda:self.buffer.readline().decode("ascii")
sys.stdin,sys.stdout = IOWrapper(sys.stdin),IOWrapper(sys.stdout)
input = lambda:sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
    main()
```