A Very Simple Problem#1096

A Very Simple Problem

1 second
64 megabytes
Hard

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

Input

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.

Output

For each test case, print a line with an integer indicating the result.

Examples

Example 1

Loading
Loading