시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 277 20 14 23.333%

문제

두 메모리 셀을 가지고 있는 컴퓨터가 있다. 각 메모리 셀은 ab로 나타낸다. 두 셀에는 정수를 저장할 수 있다. 컴퓨터가 수행할 수 있는 명령은 두 종류로 a+=bb+=a 이다. 첫 번째 명령은 a에 저장된 값을 b에 저장된 값만큼 증가시키는 것이고, 두 번째 명령은 b에 저장된 값을 a에 저장된 값만큼 증가시키는 것이다.

컴퓨터의 프로그램은 위의 두 명령으로 이루어져 있다. 프로그램의 명령은 순서대로 수행된다.

ab에 저장되어 있는 값과 S가 주어졌을 때, 두 연산으로 S를 만드는 프로그램을 만들 수 있는지 없는지를 구하는 프로그램을 작성하시오. S는 두 셀중 하나에 저장되어 있으면 된다.

입력

첫째 줄에 a, b, S가 주어진다. (0 ≤ a, b, S ≤ 1018)

출력

두 셀 중 하나에 S가 저장되는 프로그램을 만들 수 있으면 YES를, 없으면 NO를 출력한다.

예제 입력 1

1 2 3

예제 출력 1

YES

예제 입력 2

3 4 5

예제 출력 2

NO

예제 입력 3

3 4 17

예제 출력 3

YES
W3sicHJvYmxlbV9pZCI6IjkyNjciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJBK0IiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YjQ1MCBcdWJhNTRcdWJhYThcdWI5YWMgXHVjMTQwXHVjNzQ0IFx1YWMwMFx1YzljMFx1YWNlMCBcdWM3ODhcdWIyOTQgXHVjZWY0XHVkNGU4XHVkMTMwXHVhYzAwIFx1Yzc4OFx1YjJlNC4gXHVhYzAxIFx1YmE1NFx1YmFhOFx1YjlhYyBcdWMxNDBcdWM3NDAgPGNvZGU+YTxcL2NvZGU+XHVjNjQwIDxjb2RlPmI8XC9jb2RlPlx1Yjg1YyBcdWIwOThcdWQwYzBcdWIwYjhcdWIyZTQuIFx1YjQ1MCBcdWMxNDBcdWM1ZDBcdWIyOTQgXHVjODE1XHVjMjE4XHVi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