Xeni found three numbers $$$A$$$, $$$B$$$, $$$C$$$ and the equality $$$A + B = C$$$ in her old notebook, which seemed rather suspicious to her.
Xeni realized that the numbers were probably written in some alternative numeral system and decided to find all possible integer bases of numeral systems $$$b \ge 2$$$ for which all three representations are valid and the equality holds. Since there may be many such numeral systems, she decided to compute the sum of their bases.
Help Xeni compute the required sum. If there are infinitely many such bases, report it.
Recall that a representation of a number in a numeral system with base $$$b$$$ is given by an array of digits $$$d_1, d_2, \ldots, d_n$$$, from the most significant digit to the least significant one. It is valid if $$$0 \le d_i \lt b$$$ for all $$$1 \le i \le n$$$. The value of the number specified by digits $$$d_1, d_2, \ldots, d_n$$$ in base $$$b$$$ is equal to $$$$$$\sum_{i=1}^{n} d_i b^{n-i}.$$$$$$ Traditionally, for numeral systems with base greater than $$$10$$$, letters and other symbols are used to write digits, but in this problem we will simply specify the values of each digit in the number representations, without introducing special notation.
The first line contains an integer $$$n_A$$$ — the length of the representation of number $$$A$$$ ($$$1 \le n_A \le 10^5$$$). The second line contains $$$n_A$$$ integers $$$a_1, a_2, \ldots, a_{n_A}$$$ — the values of its digits ($$$0 \le a_i \le 10^9$$$).
The third line contains an integer $$$n_B$$$ — the length of the representation of number $$$B$$$ ($$$1 \le n_B \le 10^5$$$). The fourth line contains $$$n_B$$$ integers $$$b_1, b_2, \ldots, b_{n_B}$$$ — the values of its digits ($$$0 \le b_i \le 10^9$$$).
The fifth line contains an integer $$$n_C$$$ — the length of the representation of number $$$C$$$ ($$$1 \le n_C \le 10^5$$$). The sixth line contains $$$n_C$$$ integers $$$c_1, c_2, \ldots, c_{n_C}$$$ — the values of its digits ($$$0 \le c_i \le 10^9$$$).
The digits of each representation are listed from the most significant digit to the least significant one.
It is guaranteed that the number representations do not contain leading zeros.
In a single line, output the sum of all integer bases $$$b \ge 2$$$ for which the representations of numbers $$$A$$$, $$$B$$$, and $$$C$$$ are valid and the equality $$$A + B = C$$$ holds.
If there are no such bases, output $$$0$$$. If there are infinitely many such bases, output the string "inf".
2 1 2 1 3 2 2 0
5
2 1 2 2 3 4 2 4 6
inf
2 1 2 1 0 2 2 0
0