F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Final Kichiku ¡°Lanlanshu¡±

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1595    Accepted Submission(s): 619


Problem Description
During 2010 summer training, temperlisyer often does problem like this:
¡°Consider a decimal integer as sequence of digits {D0, D1 ¡­ Dn-1} (D0 > 0), if exists such x, y and z, satisfying:
1.Di-1<Di (0<i<=x)
2.Di-1=Di (x<i<=y)
3.Di-1<Di (y<i<=z)
4.Di-1>Di (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 {D0, D1 ¡­ Dn-1} (D0 > 0), define x0=0, xl=n-1, if exists such x1, x2...xl (x0 < x1 < x2 < ... < xl) satisfying:
1. If str[i]=¡¯/¡¯, Dj-1<Dj (xi<j<=xi+1)
2. If str[i]=¡¯-¡¯, Dj-1=Dj (xi<j<=xi+1)
3. If str[i]=¡¯\¡¯, Dj-1>Dj (xi<j<=xi+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.
 

Input
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.
 

Output
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.
 

Sample Input
/\ 01221 2012
 

Sample Output
00000315
 

Author
temperlsyer
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 11:22:19, Gzip enabled