1534 方程的解


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

已知n元组{a1,a2,a3,…,an},和B和P。要你判断模方程: a1x1+a2x2+a3x3+…+anxn=B (mod P)是否有整数解{x1,x2,…,xn}。

Input

多组测试数据,处理到文件结束。 每组数据第一行有三个整数n,B,P。第二行有n个整数表示a1,a2,…,an. (所有数据都在0~10000之间,包括0和10000,数据保证B<P)。

Output

如果方程有整数解,输出Yes,否则输出No。

Sample

Input

1 10 15
5
1 10 20
40

Output

Yes
No

Hint

Gcd


Source: zjut_DD


Comments

There are no comments at the moment.