eolymp
bolt
Try our new interface for solving problems

A+B

There is a computer, which has two memory cells (let us denote these cells by the letters \textbf{a} and \textbf{b}). Each cell (variable) stores some integer at any time. The computer can execute only two instructions \textbf{a+=b} and \textbf{b+=a}. The first instruction increases the value of the variable \textbf{a} by the value stored in the variable \textbf{b}. The second one, respectively, increases the value of \textbf{b} by the value \textbf{a}. A program for this computer consists of a sequence (possible empty) of such instructions. Theinstructions are executed in the appropriate order. Your task is to determine whether the given value \textbf{S} can be obtained in some cell after executing some program. \InputFile The input file contains three integers: the initial value of the variable \textbf{a}, the initial value of the variable \textbf{b} and the required value \textbf{S} (\textbf{0} ≤ \textbf{a}, \textbf{b}, \textbf{S} ≤ \textbf{10^18}). \OutputFile Output \textbf{YES} if the required value can be obtained as a result of some program execution, or \textbf{NO} otherwise.
Time limit 0.5 seconds
Memory limit 256 MiB
Input example #1
1 2 3
Output example #1
YES
Source ACM SEERC 2013, SouthEastern European Region, October, 12/10/2013, Vinnica & Bucharest