TLE '17 Contest 4 P1 - Riding the Curve

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
A beauty in mathematics.

You have just recently written a mathematics exam. Your professor, Prof. Snew, is very nice and likes to adjust the marks so that his students' grades are higher.

The exam is initially out of M marks. Prof. Snew does the following to calculate a student's new mark:

Suppose the raw mark is X. Then, add K marks to the raw mark, and make the exam out of N marks. That is, the final mark is \frac{X+K}{N}.

You now wonder to yourself, what is the minimum raw exam mark required to pass (at least 59.5\%) after adjustment?

Input Specification

The first line of input will contain three integers, M (1 \le M \le 1\,000), K (-1\,000 \le K \le 1\,000), and N (1 \le N \le 1\,000).

Output Specification

Output a single integer between 0 and M, the minimum raw exam mark required to pass. If it is impossible to pass, output have mercy snew instead.

Sample Input

50 32 80

Sample Output



There are no comments at the moment.