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

num = a

for i in range(b):

    if num % b == c:

        print('YES')

        break

    num += a

else:

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

num = a

for i in range(b):

    if num % b == c:

        print("YES")

        exit()

    num += a

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

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

-        break +        exit() -else: -    print("NO") +print("NO")