eolymp
bolt
Try our new interface for solving problems
Problems

A Very Simple Problem

A Very Simple Problem

This is a very simple problem. Given three integers \textbf{N}, \textbf{x}, and \textbf{M}, your task is to calculate out the following value: \includegraphics{https://static.e-olymp.com/content/e0/e0f88a2e00e757a8a99923646b43de2e3032d9a8.jpg} \InputFile There are several test cases. For each case, there is a line with three integers \textbf{N}, \textbf{x}, and \textbf{M}, where \textbf{1} ≤ \textbf{N}, \textbf{M} ≤ \textbf{2·10^9}, and \textbf{1} ≤ \textbf{x} ≤ \textbf{50}. The input ends up with three negative numbers, which should not be processed as a case. \OutputFile For each test case, print a line with an integer indicating the result.
Time limit 1 second
Memory limit 64 MiB
Input example #1
100 1 10000
3 4 1000
-1 -1 -1
Output example #1
5050
444