Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Maximum Multiplication

Limits 1s, 512 MB

You will be given three integers a, b and k. You can perform one of the following two operations maximum k times.

• Increase the value of a by one.
• Increase the value of b by one.

You have to maximize the value of a×b after performing all the operations.

Input

The first line of the input contains three integers a, b and k (1 ≤ a, b, k ≤ 1000).

Output

Print the maximum value of a×b after performing the above operations maximum k times.

Samples

InputOutput
2 4 3
20

In this case, we can perform the increase operations on the value a by k times. So after all the operations are done a will become 5 and b will be 4. Our final result is 4×5 = 20. This is the maximum possible answer that we can get in optimal strategy.

InputOutput
20 30 16
1089
InputOutput
50 55 6
3080
InputOutput
5 9 3
72

Statistics

90% Solution Ratio

mahfuj02Earliest, Apr '19

mahfuj02Fastest, 0.0s

piash18Lightest, 0 B

touhidurrrShortest, 80B

Submit

 Intra KUET Programming Contest 2019 Apr '19 Replay of Intra KUET Programming Contest 2019 Apr '19 Intra KUET Programming Contest 2020 Mock Jul '20 