Semester 1 is finally over, and Aaron has just gotten his functions exam back! Unfortunately, he received a score of , and it's not a . Thus, Aaron decides to go to Ms. Spiliopoulos to adjure her to give him more marks.
Max warns Aaron that while he can go have his exam reviewed, the longer he spends, the more likely Ms. Spiliopoulos is to catch the questions Aaron got wrong but were still marked correctly (there were many). In fact, given that Aaron spends minutes begging for marks, and , his mark can be modelled by the equation .
Unfortunately for Aaron, not only had he not solved the questions on the exam, but he can't seem to solve this equation either. Can you help Aaron determine what his maximal score is?
Constraints
Input Specification
The first and only line of input contain integers: , , , and .
Output Specification
Output Aaron's maximal score, to the nearest integer. Note that it may be optimal for Aaron to not go adjure for marks at all.
Sample Input
60 3 21 3
Sample Output
94
Sample Explanation
If Aaron spends minutes asking for marks, he will receive a score of , which rounds to . It can be proven this is the highest score possible.
Comments