CodeEff/ECCO huggingface dataset:
# Original solution
from heapq import heappush, heappop

n = int(eval(input()))
A = list(map(int, input().split()))

MX = 2005
f_inf = float('inf')
dp = [[0 for _ in range(MX)] for _ in range(MX)]
dp[0][0] = 0

hq = []
for i in range(n):
    heappush(hq, (-A[i], i))

ans = 0
for i in range(n):
    x, pi = heappop(hq)
    for l in range(i+1):
        r = i-l
        dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l] + (pi-l)*A[pi])
        dp[i+1][l] = max(dp[i+1][l], dp[i][l] + ((n-r-1)-pi)*A[pi])

ans = 0
for i in range(n+1):
    ans = max(ans, dp[n][i])
print(ans)

# Optimized solution
from heapq import heappush, heappop

n = int(eval(input()))
A = list(map(int, input().split()))

f_inf = float('inf')
dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
dp[0][0] = 0

hq = []
for i in range(n):
    heappush(hq, (-A[i], i))

ans = 0
for i in range(n):
    x, pi = heappop(hq)
    for l in range(i+1):
        r = i-l
        dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l] + (pi-l)*A[pi])
        dp[i+1][l] = max(dp[i+1][l], dp[i][l] + ((n-r-1)-pi)*A[pi])

ans = 0
for i in range(n+1):
    ans = max(ans, dp[n][i])
print(ans)
# Original solution
from heapq import heappush, heappop

n = int(eval(input()))
A = list(map(int, input().split()))

dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
dp[0][0] = 0

hq = []
for i in range(n):
    heappush(hq, (-A[i], i))

for i in range(n):
    x, pi = heappop(hq)
    for l in range(i+1):
        r = i-l
        dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l] + (pi-l)*A[pi])
        dp[i+1][l] = max(dp[i+1][l], dp[i][l] + ((n-r-1)-pi)*A[pi])

ans = 0
for i in range(n+1):
    ans = max(ans, dp[n][i])
print(ans)

# Optimized solution
from heapq import heappush, heappop

n = int(eval(input()))
A = list(map(int, input().split()))

hq = []
for i in range(n):
    heappush(hq, (-A[i], i))
    
dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
for i in range(n):
    x, pi = heappop(hq)
    for l in range(i+1):
        r = i-l
        dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l] + (pi-l)*A[pi])
        dp[i+1][l] = max(dp[i+1][l], dp[i][l] + ((n-r-1)-pi)*A[pi])

ans = 0
for i in range(n+1):
    ans = max(ans, dp[n][i])
print(ans)
# Original solution
n = int(eval(input()))
*A, = list(map(int, input().split()))
# n = 6
# A = [8, 6, 9, 1, 2, 1]
# n = 4
# A = [1, 3, 4, 2]
A = [(a, i) for i, a in enumerate(A)]
A.sort(reverse=True)
DP = [[0 for r in range(n+1)] for l in range(n+1)]
for l in range(n):
    for r in range(n-l):
        a, i = A[l+r]
        DP[l+1][r] = max(DP[l+1][r], DP[l][r]+a*abs(i-l))
        DP[l][r+1] = max(DP[l][r+1], DP[l][r]+a*abs(i-(n-1-r)))
print((max([DP[l][n-l] for l in range(n)])))


# Optimized solution
import sys
sys.setrecursionlimit(10000)
n = int(eval(input()))
*A, = list(map(int, input().split()))
A = [(a, i) for i, a in enumerate(A)]
A.sort(reverse=True)
DP = [[None for r in range(n+1)] for l in range(n+1)]

def dp(l, r):
    if l == r:
        DP[l][r] = 0
    if DP[l][r] != None:
        return DP[l][r]
    a, i = A[n-(r-l)]
    x = dp(l+1, r)+a*abs(i-l)
    y = dp(l, r-1)+a*abs(i-(r-1))
    DP[l][r] = max(x, y)
    return DP[l][r]

print((dp(0, n)))
# Original solution
from sys import stdin

cards = {}

n = int(eval(input()))
for line in stdin:
    m, num = line.rstrip().split(' ')
    cards[(m, int(num))] = True

for s in ['S','H','C','D']:
    for i in range(1, 14):
        if not (s, i) in cards:
            print(("{} {}".format(s, i)))

# Optimized solution
marks = ["S", "H", "C", "D"]
cards = {}

n = int(eval(input()))

for _ in range(0, n):
    mark, num = input().split()

    if mark not in cards:
        cards[mark] = []

    cards[mark].append(int(num))

for mark in marks:
    for n in range(1, 14):
        if n in cards[mark]:
            continue

        print(("{} {}".format(mark, n)))
# Original solution
r=range
v=input
l=[i+" "+str(j)for i in["S","H","C","D"]for j in r(1,14)]
for i in r(int(v())):l.remove(v())
for i in l:print(i)

# Optimized solution
r=range
v=input
l=[i+" "+str(j)for i in"SHCD" for j in r(1,14)]
for i in r(int(v())):l.remove(v())
for i in l:print(i)
# Original solution
import sys

n = int( sys.stdin.readline() )
s = [ False ] * 13
h = [ False ] * 13
c = [ False ] * 13
d = [ False ] * 13
for i in range( 0, n ):
	pattern, num = sys.stdin.readline().split( " " )
	if "S" == pattern:
		s[ int( num )-1 ] = True
	elif "H" == pattern:
		h[ int( num )-1 ] = True
	elif "C" == pattern:
		c[ int( num )-1 ] = True
	elif "D" == pattern:
		d[ int( num )-1 ] = True

for i in range( 0, 13 ):
	if not s[i]:
		print(( "S {:d}".format( i+1 ) ))
for i in range( 0, 13 ):
	if not h[i]:
		print(( "H {:d}".format( i+1 ) ))
for i in range( 0, 13 ):
	if not c[i]:
		print(( "C {:d}".format( i+1 ) ))
for i in range( 0, 13 ):
	if not d[i]:
		print(( "D {:d}".format( i+1 ) ))

# Optimized solution
import sys

n = int( sys.stdin.readline() )
cards = { 'S': [ False ] * 13, 'H': [ False ] * 13, 'C': [ False ] * 13, 'D': [ False ] * 13 }
for i in range( n ):
	pattern, num = sys.stdin.readline().split( " " )
	if "S" == pattern:
		cards[ 'S' ][ int( num )-1 ] = True
	elif "H" == pattern:
		cards[ 'H' ][ int( num )-1 ] = True
	elif "C" == pattern:
		cards[ 'C' ][ int( num )-1 ] = True
	elif "D" == pattern:
		cards[ 'D' ][ int( num )-1 ] = True

for pattern in ( 'S', 'H', 'C', 'D' ):
	for i in range( 13 ):
		if not cards[ pattern ][ i ]:
			print(( "{:s} {:d}".format( pattern, i+1 ) ))
# Original solution
import sys

n = int( sys.stdin.readline() )
cards = { 'S': [ False ] * 13, 'H': [ False ] * 13, 'C': [ False ] * 13, 'D': [ False ] * 13 }
for i in range( n ):
	pattern, num = sys.stdin.readline().split( " " )
	if "S" == pattern:
		cards[ 'S' ][ int( num )-1 ] = True
	elif "H" == pattern:
		cards[ 'H' ][ int( num )-1 ] = True
	elif "C" == pattern:
		cards[ 'C' ][ int( num )-1 ] = True
	elif "D" == pattern:
		cards[ 'D' ][ int( num )-1 ] = True

for pattern in ( 'S', 'H', 'C', 'D' ):
	for i in range( 13 ):
		if not cards[ pattern ][ i ]:
			print(( "{:s} {:d}".format( pattern, i+1 ) ))

# Optimized solution
import sys

n = int( sys.stdin.readline() )
cards = { 'S': [ False ] * 13, 'H': [ False ] * 13, 'C': [ False ] * 13, 'D': [ False ] * 13 }
for i in range( n ):
	pattern, num = sys.stdin.readline().split( " " )
	cards[ pattern ][ int( num )-1 ] = True

for pattern in ( 'S', 'H', 'C', 'D' ):
	for i in range( 13 ):
		if not cards[ pattern ][ i ]:
			print(( "{:s} {:d}".format( pattern, i+1 ) ))
# Original solution
n = int(input())
cards, suits = [], ["S", "H", "C", "D"]
for suit in suits:
    for x in range(1, 14):
        cards.append('{} {}'.format(suit, x))

for _ in range(n):
    target = ' '.join(input().split())
    if target in cards:
        cards.remove(target)

[print(c) for c in cards]


# Optimized solution
# ２次元配列バージョン
# かつ、内包表記バージョン
n = int(input())
suits = ["S", "H", "C", "D"]
cards = [[s, n] for s in suits for n in range(1, 14)]
for i in range(n):
    target = list(map(
        lambda a: int(a) if a.isnumeric() else a, input().split()
    ))
    if target in cards:
        cards.remove(target)
[print("{} {}".format(c[0], c[1])) for c in cards]
# Original solution
n = int(eval(input()))
s = [0 for s in range(13)]
h = [0 for s in range(13)]
c = [0 for s in range(13)]
d = [0 for s in range(13)]
for i in range(n):
    design, N = input().split()
    N = int(N)
    if design == "S":
        s[N-1] = 1
    elif design == "H":
        h[N-1] = 1
    elif design == "C":
        c[N-1] = 1
    else:
        d[N-1] = 1

for i in range(13):
    if s[i] == 0:
        print(("S {0}".format(i + 1)))

for i in range(13):
    if h[i] == 0:
        print(("H {0}".format(i + 1)))

for i in range(13):
    if c[i] == 0:
        print(("C {0}".format(i + 1)))

for i in range(13):
    if d[i] == 0:
        print(("D {0}".format(i + 1)))
        

# Optimized solution
n = int(eval(input()))
card = set()
for i in range(n):
    card_type, card_num = input().split()
    card.add(card_type + card_num)
for card_type in ["S", "H", "C", "D"]:
    for card_num in range(1, 14):
        if card_type + str(card_num) not in card:
            print((card_type + " " + str(card_num)))
# Original solution
A, B, C = list(map(int, input().split()))

for i in range(B):
    if i*A%B==C:
        print('YES')
        exit()

print('NO')

# Optimized solution
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')
# Original solution
# -*- coding utf-8 -*-

a,b,c=list(map(int,input().split()))
ans="NO"
for i in range(1000000):
    if (a*i-c)%b==0:
        ans='YES'
        break
print(ans)


# Optimized solution
a,b,c=list(map(int,input().split()))
ans="NO"

for i in range (100000):
    if a*i%b==c:
        ans="YES"
        break

print(ans)
# Original solution
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

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

import time

now = time.time()

mod = A
while True:
    mod += A
    if mod % B == C:
        print("YES")
        break
    if time.time()-now > 1:
        print("NO")
        break



# Optimized solution
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

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

import time

now = time.time()

for i in range(B):
    if i*A % B == C:
        print("YES")
        break

    if i == B-1:
        print("NO")
# Original solution
import sys
read = sys.stdin.read
from math import gcd
def main():
    a, b, c = list(map(int, input().split()))
    gac = gcd(a, -b)
    if c % gac == 0:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()


# Optimized solution
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    a, b, c = list(map(int, input().split()))

    num = 2
    rem = a % b
    if rem == c:
        print('YES')
        sys.exit()
    while True:
        rem_t = (a * num) % b
        if rem_t == c:
            print('YES')
            sys.exit()
        elif rem_t == rem:
            print('NO')
            sys.exit()
        num += 1

if __name__ == '__main__':
    main()
# Original solution
A,B,C = list(map(int,input().split()))

ans = False
for m in range(B):
  if m*A%B==C:
    ans = True
    break
print(('YES' if ans else 'NO'))


# Optimized solution
def gcd(x,y):
  while y:
    x, y = y, x%y
  return x

A,B,C = list(map(int,input().split()))
print(('YES' if C%gcd(A,B)==0 else 'NO'))
# Original solution
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')

# Optimized solution
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')
# Original solution
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')

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

for i in range(1,b):
  if (i*a)%b==c:
    print('YES')
    exit()
print('NO')
# Original solution
A,B,C = (int(i) for i in input().split())

dekiru = False
for i in range(B):
    if((A*(i+1))%B == C):
        dekiru = True

if dekiru:
    print("YES")
else:
    print("NO")

# Optimized solution
A,B,C = (int(i) for i in input().split())

dividable = False
for i in range(B):
    if A*(i+1) % B == C:
        dividable = True

if dividable:
    print("YES")
else:
    print("NO")
# Original solution
row = list(map(int, input().split()))
Flag = False
for i in range(10000000):
    if row[0]*i % row[1] == row[2]:
        Flag = True
        break
if Flag:
    print("YES")
else:
    print("NO")

# Optimized solution
row = list(map(int, input().split()))
Flag = False
for i in range(1000000):
    if row[0]*i % row[1] == row[2]:
        Flag = True
        break
if Flag:
    print("YES")
else:
    print("NO")
# Original solution
a,b,c=list(map(int,input().split()))
x=1
data=set()
now=0
while x==1:
    now+=a
    now%=b
    if now==c:
        print('YES')
        break
    if now in data:
        print('NO')
        break
    data|={now,}

# Optimized solution
a,b,c=list(map(int,input().split()))
res='NO'
for i in range(1,b+1):
    if (a*i)%b==c:
        res='YES'
        break
print(res)
# Original solution
import math
a, b, c = list(map(int,input().split()))

for i in range(10**7):
    n = a * i
    if n % b == c:
        print('YES')
        quit()
print('NO')

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

for i in range(b):
    n = a * i
    if n % b == c:
        print('YES')
        quit()
print('NO')
# Original solution
a,b,c = list(map(int,input().split()))
import sys
for i in  range(1000):
    if (c + a * i) % b == 0:
        print('YES')
        sys.exit()
print('NO')

# Optimized solution
a,b,c = list(map(int,input().split()))
import sys
for i in  range(1,b+1):
    if ( a * i) % b == c:
        print('YES')
        sys.exit()
print('NO')
# Original solution
A, B, C=list(map(int, input().split(" ")))
mod=[]
pivot=1
step=1

while True:
  pivot = (step*A)%B
  if (step*A)%B==C:
    print('YES')
    #print('debug', step)
    break
  elif pivot in mod:
    print('NO')
    break
  else:
    mod.append(pivot)
    step=step+1

# Optimized solution
A, B, C=list(map(int, input().split(" ")))
candidate=[(A*i)%B for i in range(1, B-1)]

if C in candidate:
  print('YES')
else:
  print('NO')
# Original solution
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    a, b, c = list(map(int, input().split()))
    count = 1

    while count < 10001:
        if ((a * count) % b) == c:
            print('YES')
            exit()

        count += 1

    print('NO')


# Optimized solution
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    a, b, c = list(map(int, input().split()))
    count = 1

    while count < (b + 1):
        if ((a * count) % b) == c:
            print('YES')
            exit()

        count += 1

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

# Optimized solution
a,b,c = list(map(int, input().split()))
ans = "NO"
for i in range(1, b+1):
    if (a*i) % b == c:
        ans = "YES"
        break
print(ans)
# Original solution
A,B,C=list(map(int,input().split()))
a=[A*(i+1)%B for i in range(B)]
if C in a:
    print('YES')
else:
    print('NO')

# Optimized solution
A,B,C=list(map(int,input().split()))
for i in range(B):
    if A * (i+1) % B == C:
        print("YES")
        exit()
print("NO")
# Original solution
a,b,c =list(map(int,input().split()))

D=[]


for n in range(1, 10000):

    if((a * n) % b) == c:
        D.append("Y")   
        
if len(D)>0:
    print("YES")
else:
    print("NO")
    


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

for i in range(100):
    if A*i%B==C:
        print("YES")
        break
        
else:
    print("NO")
# Original solution
a,b,c = list(map(int,input().split()))
count = 0
if a%2==0 and b%2==0 and c%2!=0:
  print("NO")

else:
  for i in range(1,1000):
    x = a*i
    for j in range(1,1000):
      if x%b == c:
        count += 1
      else:
        continue
  if count==0:
    print("NO")
  else:
    print("YES")

# Optimized solution
a,b,c, = list(map(int,input().split()))
print(('YES' if any(a*i%b==c for i in range(1,b+1)) else 'NO'))
# Original solution
a, b, c = list(map(int, input().split()))
A = a
for i in range(10**7 + 1):
    A += a
    if A%b == c:
        print("YES")
        exit()
print("NO")

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

for i in range(1, b+1):
    if (a*i)%b == c:
        print("YES")
        exit()
print("NO")
# Original solution
A, B, C = list(map(int, input().split()))
ans = 'NO'
for i in range(1, 1000):
    if A*i % B == C:
        ans = 'YES'
print(ans)


# Optimized solution

A, B, C = list(map(int, input().split()))
ans = 'NO'
for i in range(1, 1000):
    if A*i % B == C:
        ans = 'YES'
        break
print(ans)
# Original solution
def resolve():
	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)
resolve()

# Optimized solution
def resolve():
	a, b, c = list(map(int, input().split()))
	ans = 'NO'
	for i in range(1, b):
		if a*i % b == c:
			ans = 'YES'
	print(ans)
resolve()
# Original solution
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
a,b,c=list(map(int,input().split()))

if any((a*i)%b==c for i in range(1,b+1)):
		print("YES")
else:
		print("NO")

# Optimized solution
import sys
a,b,c=list(map(int,input().split()))

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

ans = 'NO'
if a < b and c%a == 0:
  ans = 'YES'
else:
  for i in range(1, 100000):
    if (b*i + c)%a == 0:
      ans = 'YES'
      break
  
print(ans)

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

ans = 'NO'
if a < b and c%a == 0:
  ans = 'YES'
else:
  for i in range(1, 10000):
    if (b*i + c)%a == 0:
      ans = 'YES'
      break
  
print(ans)
# Original solution
a, b, c = list(map(int, input().split()))

ans = 'NO'
if a < b and c%a == 0:
  ans = 'YES'
else:
  for i in range(1, 1000):
    if (b*i + c)%a == 0:
      ans = 'YES'
      break
  
print(ans)

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

ans = 'NO'
if a < b and c%a == 0:
  ans = 'YES'
else:
  for i in range(1, 100):
    if (b*i + c)%a == 0:
      ans = 'YES'
      break
  
print(ans)
# Original solution
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A,B,C = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    mod_arr = []
    a = 1
    while True:
        _ = (a*A)%B
        if _ == C:
            TF = 'YES'
            break
        elif _ in mod_arr:
            TF = 'NO'
            break
        else:
            mod_arr.append(_)
            a+=1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


# Optimized solution
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A,B,C = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    for a in range(1,B+1):
        _ = (a*A)%B
        if _ == C:
            TF = 'YES'
            break
    else:
        TF = 'NO'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)
# Original solution
a,b,c=list(map(int,input().split()))
for i in range(10**6):
    if (i*b+c)%a==0:
        print("YES")
        exit()
print("NO")


# Optimized solution
a, b, c = list(map(int, input().split()))
tmp = 0
for i in range(1, b + 1):
    tmp = a * i
    if tmp % b == c:
        print("YES")
        exit()
print("NO")
# Original solution
A, B, C = list(map(int, input().split()))
lis = list(range(1, 100000))
AA =0
for i in lis:
    AA = A*i
    if AA%B == C:
        print('YES')
        break
else:
    print('NO')

# Optimized solution
A, B, C = list(map(int, input().split()))
for i in range(1, 500):
    if (A * i) % B == C:
        print('YES')
        break
else:
    print('NO')
# Original solution
a,b,c=list(map(int,input().split()))
l=[]
for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    l.append(i)
if l==[]:
  print("YES")
elif c%l[-1]==0:
  print("YES")
else:
  print("NO")

# Optimized solution
a,b,c=list(map(int,input().split()))
d=False
for i in range(1,b+1):
  if a*i%b==c:
    d=True
    break
if d==True:
  print("YES")
else:
  print("NO")
# Original solution
A, B, C = list(map(int, input().split()))
a = A
count = 10001
result = 'NO'

while count > 0:
    if A%B == C:
        result = 'YES'
        break
    A += a
    count -= 1

print(result)

# Optimized solution
A, B, C = list(map(int, input().split()))
a = A
result = 'NO'

for _ in range(10001):
    if A%B == C:
        result = 'YES'
        break
    A += a

print(result)
# Original solution
A, B, C = list(map(int,input().split()))

for i in range(1,10000):
    a = A*i
    if a % B == C:
        print('YES')
        exit()
print('NO')




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

for i in range(1,B+1):
    a = A*i
    if a % B == C:
        print('YES')
        exit()
print('NO')
# Original solution
A,B,C = list(map(int,input().split()))
flag = 0
for i in range(B):
    if (i*A)%B==C:
        flag = 1
        break
if flag==1:
    print("YES")
else:
    print("NO")

# Optimized solution
A,B,C = list(map(int,input().split()))
flag = 0
for k in range(B):
    if (k*A)%B==C:
        flag = 1
        break
if flag==1:
    print("YES")
else:
    print("NO")
# Original solution
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

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

# Optimized solution
a, b, c = list(map(int, input().split()))
for i in range(1, 100):
    if a*i % b == c:
        print("YES")
        exit()
print("NO")
# Original solution
#coding: utf-8

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

for i in range(A*B):
    if(A*i % B == C):
        count = 1
    else:
        print('',end='')

if(count == 1):
    print('YES')
else:
    print('NO')


# Optimized solution
#coding: utf-8

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

for i in range(A*B):
    if(A*i % B == C):
        print('YES')
        break
else:
    print('NO')
# Original solution
a, b, c = list(map(int, input().split()))

i = 1
while i <= b:
    if (a * i) % b == c:
        print("YES")
        exit()
    i += 1

print("NO")

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

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

for i in range(1, 101):
    if i * a % b == c:
        print("YES")
        exit()
else:
    print("NO")


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

for i in range(1, 100):
  if (a * i) % b == c:
    print("YES")
    exit()
else:
  print("NO")
# Original solution
# ABC 60 B

def resolve():
    A, B, C = list(map(int, input().split()))
    for i in range(B+1):
        if A * i % B == C:
            print('YES')
            return
    print('NO')

if __name__ == "__main__":
    resolve()


# Optimized solution
def resolve():
  a, b, c = list(map(int, input().split()))
  for i in range(1, 100):
    if a * i % b == c:
      print("YES")
      return
  print("NO")
  return

if __name__ == "__main__":
  resolve()
# Original solution
# B - Choose Integers
def main():
    a, b, c = list(map(int, input().split()))


    for i in range(1, 1000):
        if a*i % b == c:
            print('YES')
            exit()
    else:
        print('NO')


if __name__ ==  "__main__":
    main()

# Optimized solution
# B - Choose Integers
def main():
    a, b, c = list(map(int, input().split()))


    for i in range(1, a*b+1):
        if a*i % b == c:
            print('YES')
            exit()
    else:
        print('NO')


if __name__ ==  "__main__":
    main()
# Original solution
a = list(map(int,input().split()))
b = "NO"

for i in range(10000):
  if i%a[0]==0 and i%a[1]==a[2]:
    b = "YES"
else:
  print(b)

# Optimized solution
A,B,C = list(map(int,input().split()))
z = "NO"

for i in range(10000):
  if i%A==0 and i%B==C:
    z = "YES"

print(z)