This is a very simple problem. Given three integers , , and , your task is to calculate the following value:

There are several test cases. For each case, there is a line with three integers , , and , where 1 \leq N, M \leq 2 \cdot 10^9, and 1 \leq x \leq 50.
The input ends with a line containing three negative numbers, which should not be processed as a case.
For each test case, print a line with an integer indicating the result.
Example 1