Hacker Kirill was nostalgically going through his school notebooks on computer science and noticed that the number system was not indicated in some addition problems. He was wondering: is it possible to unambiguously determine the number system that was used for addition only by using the recording of a problem?
Help Kirill — write a program that, with given terms and sum, will unambiguously restore the number system used for addition or inform that unambiguous restoration is not possible.
Proceed from the assumption that the addition is performed correctly.
The first line contains the first term, the second – second term, and the third – sum. To denote numbers use digits from «$$$0$$$» to «$$$9$$$» and capital Latin letters from «$$$A$$$» to «$$$Z$$$».
Terms and sum can be of different lengths, but the length of any of these numbers does not exceed $$$256$$$ digits.
If unambiguous restoration of the number system is not possible, output $$$0$$$; otherwise – output the whole positive base of the number system.
A 6 10
16
1 2 3
0
1 Y Z
0
| Name |
|---|


