Problem: Being bored of exploring the Moon over and over again Wall-B decided to explore something he is made of — binary numbers. He took a binary number and decided to count how many times different substrings of length two appeared. He stored those values in , , and , representing how many times substrings 00, 01, 10 and 11 appear in the number respectively. For example:
Wall-B noticed that there can be multiple binary numbers satisfying the same , , and constraints. Because of that he wanted to count how many binary numbers satisfy the constraints given the interval . Unfortunately, his processing power wasn't strong enough to handle large intervals he was curious about. Can you help him? Since this number can be large print it modulo .
Input Format: First two lines contain two positive binary numbers and (), representing the start and the end of the interval respectively. Binary numbers and have no leading zeroes.
Next four lines contain decimal numbers , , and () representing the count of two-digit substrings 00, 01, 10 and 11 respectively.
Output Format: Output one integer number representing how many binary numbers in the interval satisfy the constraints mod .
Note: Example 1: The binary numbers in the interval are . Only number 110 satisfies the constraints: .
Example 2: No number in the interval satisfies the constraints