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



for i in range(1,10**6):

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

    print('YES')

    exit()



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



for i in range(1,b):

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

    print('YES')

    exit()

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

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

-for i in range(1, 10**6): -    if (a * i) % b == c: +for i in range(1, b): +    if (i * a) % b == c: