The Great Triangular Area (GTA) is a right-angled triangle with legs of lengths and state units of length (SUL). The GTA government wants to cover as much of this area as possible with square tiles of size 1 \times 1 SUL. The tiles must fit tightly together and along the triangle's legs; cutting tiles is not allowed.

According to international agreements, the GTA government cannot cover any area outside its own region with its tiles. The manufacturer delivers tiles only in containers, each holding tiles. The government orders as many containers as needed for the project.
The head of the central warehouse wants to know how many tiles will remain in the warehouse from the last container after the project is completed.
The input consists of a single line with three integers: , (2 \leq M, N \leq 2000000000), and (100 \leq P \leq 10000).
The output should be a single integer: the number of unused tiles from the last container.
Example 1