A, B, C = list(map(int, input().split()))



for i in range(B):

    if i*A%B==C:

        print('YES')

        exit()



print('NO')
A, B, C = list(map(int, input().split()))



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

    if i*A%B==C:

        print('YES')

        break

else:

    print('NO')
A, B, C = list(map(int, input().split()))
for i in range(B):
    if i * A % B == C:
        print("YES")
        exit()
print("NO")

A, B, C = list(map(int, input().split()))
for i in range(1, B + 1):
    if i * A % B == C:
        print("YES")
        break
else:
    print("NO")

-for i in range(B): +for i in range(1, B + 1): -        exit() -print("NO") +        break +else: +    print("NO")