Jumping Jill

Program time limit: 1 second

Program memory limit: 128 MB

Jack and Jill are on different points on the number line and want to meet up. Jack is at position $x$, and Jill is at position $y$. However, they can only make jumps of a certain size. Jack can make jumps of size $a_1, \dots, a_n$, while jill can make jumps of size $b_1, \dots, b_n$. (The jumps can be made in either direction).

Can Jack and Jill meet at the same position? Print Yes if so, otherwise print No.

Input

The first line of input contains space seperated integers $n$, $x$ and $y$. The second line of input contains space seperated integers $a_1, \dots, a_n$. The third line of input contains space seperated intergers $b_1, \dots, a_n$.

Constraints

For all test cases:

  • $1 \le n \le 100$.
  • $1 \le x, y \le 10^6$.
  • $1 \le a_i, b_i \le 10^6$ for all $i$.

Output

Output a single line, containing Yes or No, stating whether Jack and Jill can meet.

You should write to standard output.

In Python, you could use the line print(answer).

In C or C++, you could use the line printf("%d\n", answer);.

Sample Input 1

1 1 3
14
6

Sample Output 1

Yes

Explanation 1

Jack begins at position 1, and Jill begins at position 3. Jack can make a jump of size 14 to the right, ending on position 15. Jill can make 2 jumps of sze 12 to the right, ending on position 15. So Jack and Jill can meet at position 15.

Sample Input 2

2 4 11
4 12
6 2

Sample Output 2

No

Explanation 2

There is no way for Jack and Jill to meet at any position.

Scoring

Your program will be run on the 2 sample cases and 8 secret cases one after another. You must pass all testcases in order to score points. Recall that your final score on the task is the score of your highest scoring submission.


Submit

Log in to submit!

Past submissions

You haven't submitted to this task.