406017: GYM102218 K K-th Missing Digit

Memory Limit:32 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. K-th Missing Digittime limit per test0.5 secondsmemory limit per test32 megabytesinputstandard inputoutputstandard output

You're given two positive integers $$$A$$$ and $$$B$$$, and a string $$$P$$$, representing their product but with a missing digit indicated with an $$$*$$$. Find the missing digit.

It's guaranteed that the missing digit isn't $$$0$$$.

Input

The first line contains three integers $$$a$$$, $$$b$$$ and $$$p$$$ ($$$1 \leq a, b < 10^6$$$, $$$1 \leq p < 2*10^6$$$) $$$-$$$ the number of digits in $$$A$$$, $$$B$$$ and $$$P$$$ respectively.

The second line contains positive number $$$A$$$.

The third line contains positive number $$$B$$$.

The fourth line contains string $$$P$$$ $$$-$$$ the product of $$$A$$$ and $$$B$$$ with a missing digit.

Output

Print one integer representing the missing digit in $$$P$$$.

ExamplesInput
1 1 2
3
8
2*
Output
4
Input
2 2 3
10
10
*00
Output
1

加入题单

上一题 下一题 算法标签: