a,b,c=list(map(int,input().split()))

for i in range(1,1000000):

  if (i*b+c)%a==0:

    print('YES')

    exit()

    

print('NO')
a,b,c=list(map(int,input().split()))

for i in range(1,10000):

  if (i*b+c)%a==0:

    print('YES')

    exit()

    

print('NO')

a, b, c = list(map(int, input().split()))
for i in range(1, 1000000):
    if (i * b + c) % a == 0:
        print("YES")
        exit()
print("NO")

a, b, c = list(map(int, input().split()))
for i in range(1, 10000):
    if (i * b + c) % a == 0:
        print("YES")
        exit()
print("NO")

-for i in range(1, 1000000): +for i in range(1, 10000):