#P1051E. Vasya and Big Integers
Vasya and Big Integers
Description
Vasya owns three big integers — . Let's define a partition of such a sequence of strings that , where is a concatanation of strings. is the -th element of the partition. For example, number has the following partitions: ["1", "2", "3", "4", "5"], ["123", "4", "5"], ["1", "2345"], ["12345"] and lots of others.
Let's call some partition of beautiful if each of its elements contains no leading zeros.
Vasya want to know the number of beautiful partitions of number , which has each of satisfy the condition . Note that the comparison is the integer comparison, not the string one.
Help Vasya to count the amount of partitions of number such that they match all the given requirements. The result can be rather big, so print it modulo .
The first line contains a single integer .
The second line contains a single integer .
The third line contains a single integer .
It is guaranteed that .
It is also guaranteed that numbers contain no leading zeros.
Print a single integer — the amount of partitions of number such that they match all the given requirements modulo .
Input
The first line contains a single integer .
The second line contains a single integer .
The third line contains a single integer .
It is guaranteed that .
It is also guaranteed that numbers contain no leading zeros.
Output
Print a single integer — the amount of partitions of number such that they match all the given requirements modulo .
Note
In the first test case, there are two good partitions and .
In the second test case, there is one good partition .