I found an interesting problem on https://atcoder.jp/contests/abc060/tasks/abc060_b:
We ask you to select some number of positive integers, and calculate the sum of them.
It is allowed to select as many integers as you like, and as large integers as you wish.
You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer.
Your objective is to make the sum congruent to C modulo B.
Determine whether this is possible.
If the objective is achievable, print YES. Otherwise, print NO.

-----Constraints-----
 - 1 ≤ A ≤ 100
 - 1 ≤ B ≤ 100
 - 0 ≤ C < B

-----Input-----
Input is given from Standard Input in the following format:
A B C

-----Output-----
Print YES or NO.

-----Sample Input-----
7 5 1

-----Sample Output-----
YES

For example, if you select 7 and 14, the sum 21 is congruent to 1 modulo 5.

I tried it in Python, but could not do it. Can you solve it?
a, b, c = list(map(int, input().split()))
for i in range(a, (a * b) + 1, a):
    if i % b == c:
        print("YES")
        return
print("NO")