Training Site
Sideways banner

Betty the Cat 2.5 (one-liner destroyer)

Input: Standard Input (stdin)
Output: Standard Output (stdout)
Memory limit: 32 megabytes
Time limit: 1.0 seconds

Betty the cat has started going to the gym and is looking to grow her muscles. To help with her bulk, she has brought two types of creatine-filled cookie boxes: ones with A cookies per box, and ones with B cookies per box. Betty has an infinite number of these. When she opens a cookie box, she is morally obliged to eat all the cookies in the box.

Betty has a target cookie quota of K cookies a day. She wants to know: what is the closest amount she can get to her target cookie quota, and what is the minimum number of boxes she needs for this amount.


The input will contain three space-separated integers A, B and K


Output two numbers separated by a space - the smallest possible absolute difference between target and actual cookies consumed, and the minimum number of cookie boxes required to achieve this.


1 \le A, B, K \le 10^{15}