题目描述
Problem Description
Given an integer sequence $A$ of length $N$, an integer sequence $B$ of length $M$, and an integer $K$, define the values $X$ and $Y$ as follows:
- $X=\ \sum_{i=1}^N\ A_i\ \times\ K^{N-i}\ =\ A_1\ \times\ K^{N-1}\ +\ A_2\ \times\ K^{N-2}\ +\ ...\ +\ A_N\ \times\ K^0$
- $Y=\ \sum_{i=1}^M\ B_i\ \times\ K^{M-i}\ =\ B_1\ \times\ K^{M-1}\ +\ B_2\ \times\ K^{M-2}\ +\ ...\ +\ B_M\ \times\ K^0$
Determine whether $X$ is smaller than, greater than, or equal to $Y$.
Input Format
The input is given from the standard input in the following format:
$ N $ $ M $ $ K $ $ A_1 $ $ A_2 $ $\cdots$ $ A_N $ $ B_1 $ $ B_2 $ $\cdots$ $ B_M $
Output Format
Output X if $X < Y$, Y if $X > Y$, and Same if $X = Y$.
Sample Input and Output
Sample Input #1
3 3 10
1 2 3
1 2 4
Sample Output #1
X
Sample Input #2
4 3 13
1 2 3 4
4 5 6
Sample Output #2
Y
Sample Input #3
4 4 2
1 1 0 1
1 1 0 1
Sample Output #3
Same
Notes/Hints
Constraints
- $1\ \leq\ N\ \leq\ 10^5$
- $1\ \leq\ M\ \leq\ 10^5$
- $2\ \leq\ K\ \leq\ 10^9$
- $0\ \leq\ A_i\ \leq\ K-1$
- $1\ \leq\ A_1$
- $0\ \leq\ B_i\ \leq\ K-1$
- $1\ \leq\ B_1$
- All values input are integers.
Sample Explanation 1
$ X=123, Y=124 $, and since $ X < Y $, output X.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
3 3 10
1 2 3
1 2 4
样例输出
X