Contest Duration: - (local time) (180 minutes) Back to Home
C - Add Mod Operations /

Time Limit: 2 sec / Memory Limit: 1024 MB

### 問題文

• 操作：0\leq x < y\leq 10^{18} を満たす整数 x,y を選ぶ．すべての i に対して，A_i(A_i+x)\bmod y に置き換える．

AB に一致させることが可能な場合には，そのような手順をひとつ出力してください．

### 制約

• 1\leq N\leq 1000
• 0\leq A_i\leq 10^9
• 0\leq B_i\leq 10^9

### 入力

N
A_1 \ldots A_N
B_1 \ldots B_N


### 出力

0 回以上 N 回以下の操作で AB に一致させることが不可能な場合には，No と出力してください．

No


Yes
K
x_1 y_1
\vdots
x_K y_K


ここで K は操作回数で，x_i, y_ii 回目の操作で選ぶ整数 x,y を表します．これらは次を満たす必要があります．

• 0\leq K\leq N
• 0\leq x_i < y_i \leq 10^{18}

### 入力例 1

4
7 2 4 5
3 3 5 0


### 出力例 1

Yes
2
3 5
3 6


• はじめ A = (7,2,4,5) です．
• (x,y) = (3,5) として操作を行うと，A = (0,0,2,3) になります．
• (x,y) = (3,6) として操作を行うと，A = (3,3,5,0) になります．

### 入力例 2

1
5
3


### 出力例 2

Yes
1
2 4


### 入力例 3

2
3 1
3 1


### 出力例 3

Yes
0


### 入力例 4

2
0 0
1 2


### 出力例 4

No


Score : 800 points

### Problem Statement

You are given sequences of non-negative integers: A = (A_1, \ldots, A_N) and B=(B_1, \ldots, B_N).

Determine whether one can make A equal B by performing the following operation between 0 and N times, inclusive.

• Operation: Choose integers x,y such that 0\leq x < y\leq 10^{18}. For every i, replace A_i with (A_i+x)\bmod y.

If one can make A equal B, print one way to do so.

### Constraints

• 1\leq N\leq 1000
• 0\leq A_i\leq 10^9
• 0\leq B_i\leq 10^9

### Input

The input is given from Standard Input in the following format:

N
A_1 \ldots A_N
B_1 \ldots B_N


### Output

If one cannot make A equal B by performing the operation between 0 and N times, inclusive, print No.

No


If one can do so, print one way in the following format:

Yes
K
x_1 y_1
\vdots
x_K y_K


Here, K is the number of operations, and x_i, y_i are integers x, y chosen in the i-th operation. These must satisfy the following:

• 0\leq K\leq N
• 0\leq x_i < y_i \leq 10^{18}

If there are multiple ways to achieve the objective, you may print any of them.

### Sample Input 1

4
7 2 4 5
3 3 5 0


### Sample Output 1

Yes
2
3 5
3 6


One can make A equal B as follows.

• Initially, A = (7,2,4,5).
• The operation with (x,y) = (3,5) makes A = (0,0,2,3).
• The operation with (x,y) = (3,6) makes A = (3,3,5,0).

### Sample Input 2

1
5
3


### Sample Output 2

Yes
1
2 4


### Sample Input 3

2
3 1
3 1


### Sample Output 3

Yes
0


### Sample Input 4

2
0 0
1 2


### Sample Output 4

No