시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 2048 MB43375.000%

문제

A square field has been divided into $N^2$ rectangular plots by drawing $(N-1)$ vertical and $(N-1)$ horizontal lines. The rows of plots are numbered $1 \ldots N$ from bottom to top and the columns $1 \ldots N$ from left to right, as shown on the figures below (the figures are not to scale).

The plots located at the intersection of the $i$-th column and the $i$-th row (for $1 \le i \le N$) are called the long diagonal. The plots located at the intersection of the $(i+1)$-st column and the $i$-th row (for $1 \le i \le N-1$) are called the short diagonal.

You know the areas of the plots on the long and short diagonals. Calculate the area of the plot at the intersection of the $X$-th column and the $Y$-th row.

입력

The first line contains the integer $N$ ($2 \le N \le 1\,000$).

The second line contains $N$ integers $A_1, A_2, \dots, A_N$ ($1 \le A_i \le 10^9$) --- the areas of the plots on the long diagonal.

The third line contains $N-1$ integers $B_1, B_2, \dots, B_{N-1}$ ($1 \le B_i \le 10^9$) --- the areas of the plots on the short diagonal.

The fourth line contains two integers $X$ and $Y$ ($1 \le X, Y \le N$) --- the coordinates of the plot whose area should be calculated.

출력

Output the area $S$ of the plot located at the intersection of the $X$-th column and the $Y$-th row. The answer should be represented as a sequence of lines, each containing two integers $P_i$ and $S_i$. The numbers $P_i$ must be distinct primes. The numbers $S_i$ must be non-zero integers such that $$ S = P_1^{S_1} \cdot P_2^{S_2} \cdot P_3^{S_3} \cdot \ldots \cdot P_k^{S_k}, $$ where $k$ is the number of lines in the answer. The lines must be listed in increasing order of $P_i$. (Recall that an integer $P$ is considered prime if it has exactly two positive integer divisors: $1$ and $P$.)

If $S = 1$, then output it as a single line "1 1".

서브태스크

번호배점제한
15

Each known area is either $1$ or a prime less than $100$; $X = Y$ or $X = Y + 1$.

25

Each known area is either $1$ or a prime less than $100$; $X = Y - 1$.

35

Each known area is at most $10\,000$; $X = Y$ or $X = Y + 1$.

45

$X = Y$ or $X = Y + 1$.

55

Each known area is at most $10\,000$; $X = Y - 1$.

65

$X = Y - 1$.

75

$N = 5$; each known area is at most $100$.

85

Each known area is either $1$ or a prime less than $100$; $X = 1$ and $Y = N$.

95

Each known area is either $1$ or a prime less than $100$; $X = N$ and $Y = 1$.

105

Each known area is either $1$ or a prime less than $100$; $X < Y$.

115

Each known area is either $1$ or a prime less than $100$; $X > Y$.

125

Each known area is at most $100$; $X = 1$ and $Y = N$.

135

Each known area is at most $100$; $X = N$ and $Y = 1$.

145

Each known area is at most $100$; $X < Y$.

155

Each known area is at most $100$; $X > Y$.

165

$X = 1$ and $Y = N$.

175

$X = N$ and $Y = 1$.

188

$X < Y$.

197

$X > Y$.

예제 입력 1

5
6 1 3 9 5
3 9 3 6
2 3

예제 출력 1

3 -1

This example corresponds to the left figure above. The area of the plot at the intersection of the 2-nd column and the 3-rd row is $$ S = \frac{1}{3} = 3^{-1}. $$

예제 입력 2

5
5 2 8 3 5
2 6 8 9
5 2

예제 출력 2

2 1
3 2

This example corresponds to the right figure above. The area of the plot at the intersection of the 5-th column and the 2-nd row is $$ S = 18 = 2^{1} \cdot 3^2. $$

예제 입력 3

5
6 1 3 9 5
3 9 3 6
2 4

예제 출력 3

1 1

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 2이다.