P15090 [UOI 2025 II Stage] Movies

Description

Deadpool is watching movies about Wolverine from different universes on a multiverse movie website. It is known that there are a total of $n$ movies, and each page of the website displays $k$ different movies (with the last page showing all remaining ones). Deadpool doesn't have much time, so he goes straight to the last page and watches all the movies from it. Each movie lasts exactly $c$ minutes. How much time did he spend watching the movies?

Input Format

The first line contains three integers $n$, $k$, $c$ $(1 \le n, k, c \le 10^4)$ --- the number of movies, the number of movies on one page, and the duration of one movie.

Output Format

Output a single number $t$, the amount of time that Deadpool will spend watching the movies.

Explanation/Hint

In the first example, we have $20$ movies and $3$ movies on each page except the last one, so there are $2$ movies on the last page, and watching those two movies will take a total of $120$ minutes. In the second example, there are a total of $65$ movies and $10$ movies per page, so there will be $5$ movies on the last page, and watching them will take $150$ minutes. In the third example, there are $100$ movies, with $20$ movies per page, so there will be $20$ movies on the last page, and Deadpool will watch them for $1800$ minutes.