During 2010 summer training, temperlisyer often does problem like this:
“Consider a decimal integer as sequence of digits {D
0, D
1 … D
n-1} (D
0 > 0), if exists such x, y and z, satisfying:
1.D
i-1<D
i (0<i<=x)
2.D
i-1=D
i (x<i<=y)
3.D
i-1<D
i (y<i<=z)
4.D
i-1>D
i (z<i<=n-1)
We call this integer “Lanlanshu”, now give you two numbers A and B, calculate how many “Lanlanshu” are in [A, B].“
He solved so many of these and finally get bored, and then get crazy! He decided to make up a problem to put this type of problems to an end.
Give you a string str consists only by ‘/’, ‘-‘ and ‘\’, and its length is l. Consider a decimal integer as sequence of digits {D
0, D
1 … D
n-1} (D0 > 0), define x
0=0, x
l=n-1, if exists such x
1, x
2...x
l (x
0 < x
1 < x
2 < ... < x
l) satisfying:
1. If str[i]=’/’, D
j-1<D
j (x
i<j<=x
i+1)
2. If str[i]=’-’, D
j-1=D
j (x
i<j<=x
i+1)
3. If str[i]=’\’, D
j-1>D
j (x
i<j<=x
i+1)
We call it Final Kichiku “Lanlanshu”, now give you two numbers A and B, calculate how many Final Kichiku “Lanlanshu” are in [A, B]. This number maybe huge, we only want to now the last 8 digits of the result.
Multiple cases (no more than 100), for each case:
The first line is string str, length is below 100.
The second line contains two integers A and B (0≤Ai≤Bi≤10^100).
Input terminates by EOF.
For each case, output 8 digits representing the last 8 digits of the number of Final Kichiku “Lanlanshu” in [A, B]. If it’s less than 8 digits, fill it with leading zeros.