Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/avtoturargoh-tolovi

Parking fee

Medium 1000 ms 64 MB 41%
Share

At a car park, the first $60$ minutes are free. After that, $p$ soums are charged for every started hour: for example, a car that stayed $61$ minutes pays $p$ soums, and one that stayed $121$ minutes pays $2 * p$ soums. But the fee for a day never exceeds $M$ soums: if the computed amount is larger than $M$, $M$ soums are paid. A car stayed $t$ minutes. Find the fee.

A time axis: the first hour is free, each next started hour costs p; the total is capped at M

Input

One line with three positive integers: $t$, $p$ and $M$.

Output

One integer — the fee.

Note

$1 \le t \le 1440$
$1 \le p \le 10^{5}$
$1 \le M \le 10^{6}$

Examples

Input #1
150 3000 10000
Output #1
6000
Input #2
1440 3000 20000
Output #2
20000

Sign in to submit a solution

Signing up is free and takes a minute.