DIOEQ - DIOPHANTINE

no tags 

Given a,b,c (where a,b not both zero) your task is to find if there exist any integers x,y that satisify the equation a*x+b*y=c.

Input

The input consists of several test cases. Each test case contains a line with the three integers a,b,c (a,b,c <= 10000000). The test case 0 0 0 indicates the end of input.

Output

For each test case you must output "YES" if there exists a solution,otherwise output "NO". (quotes only for clarity)

Example

Input:
1 9 1
5 10 19
0 0 0

Output:
YES
NO

hide comments
starbot: 2017-06-13 19:50:54

5 lines

Marko JagodiƦ: 2010-12-19 13:46:44

can a or b or c be negative number


Added by:abhijith reddy d
Date:2009-04-06
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS OBJC PERL6 VB.NET
Resource:own