Pull-ups
Limits: 2 sec., 512 MiB
This statement was translated automatically from Ukrainian.
Today was a really difficult day for Zenik. He failed to solve the "A + B" problem on Algotester and to top it all off, it is raining heavily. Probably the only thing left for him to do was to go do some pull-ups. However, Zenik, as a true athlete, set goals for himself that need to be met.
For example, this time he needs to complete \(n\) sets, such that the number of pull-ups in each set is not less than \(k\). In addition, the total number of pull-ups for the workout cannot be less than \(m\). Output the minimum total number of pull-ups Zenik needs to do to fulfill today’s goal if Zenik distributes the number of pull-ups optimally.
Input
The single line contains three integers \(n, m, k\) — the number of sets, the minimum total number of pull-ups for the workout, and the minimum number of pull-ups per set, respectively.
Output
Output a single number — the minimum number of pull-ups.
Constraints
\(1 \le n, m, k \le 10^9\),
\(n \cdot k \le 10^9\).
Scoring consists of the following blocks:
1 point for each example from the statement,
20 points: \(n = 1\),
30 points: \(n \cdot k \le m\),
48 points: no additional constraints.
You will receive the points for a block only if your program passes all tests in that block.
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 2 5 3 | 6 |
| Input (stdin) | Output (stdout) |
|---|---|
| 2 7 3 | 7 |
Notes
In the first example, the optimal distribution of pull-ups would be to do three pull-ups in each of the two sets to satisfy the conditions.
In the second example, one of the optimal distributions of pull-ups would be to do four pull-ups in the first set and three in the second.
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|