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

for i in range(1, b + 1):

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

        ans = 'YES'

        break

    else:

        ans = 'NO'

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

ans = 'NO'

for i in range(1, b + 1):

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

        ans = 'YES'

        

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

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

+ans = "NO" -        break -    else: -        ans = "NO"