404652: GYM101604 D Wet Shark and Smallest Number
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
D. Wet Shark and Smallest Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Today, Wet Shark was given a list of non-necessarily distinct prime integers, a1, a2, ...an.
Wet Shark defines k as the smallest integer such that for 1 ≤ i ≤ n, k mod ai = ai - 1.
Wet Shark also has an additional integer, o. Tell Wet Shark whether or not k is divisible by o.
InputThe first line contains one integer, n 1 ≤ n ≤ 100000.
The second line consists of n space separated integers, the list of primes. Each prime ranges from 2 to 100000.
The third line consists of the additional integer, o, ranging from 1 to 100000.
OutputIf k is divisible by o, output "YES". Else, output "NO".
ExamplesInput1Output
3
2
YESInput
2Output
3 3
4
NO