Ksonya and the Olympiad
The results of the Olympiad can be found after the event at the link oi.in.ua
Ksonya and her classmates arrived at the Olympiad minutes before it began. Due to quarantine restrictions, the organizers allow students to enter the auditorium every minutes.
This means that students will enter the Olympiad exactly minutes before it starts. Another students will enter minutes before the start, and another students will enter minutes before the start, continuing in this pattern. Students can enter even at minutes before the start (i.e., when the Olympiad begins). However, no students can enter after the Olympiad has started.
There are students in the class, including Ksonya. How many students will be able to enter the auditorium before the Olympiad starts?
Input
The first line contains four integers ().
Output
Output a single number — the number of students who will manage to enter the Olympiad.
Examples
Note
Explanation for the first example:
4 minutes before the start, a group of two students enters the Olympiad.
3 minutes before, the remaining three students wait.
2 minutes before, the remaining three students wait.
1 minute before, another group of two students enters the Olympiad.
At 0 minutes, one remaining student waits. Since time is up, only four students managed to enter.
Explanation for the second example:
4 minutes before the start of the Olympiad, a group of three students enters the Olympiad.
3 minutes before, the remaining three students wait.
2 minutes before, another group of three students can enter the Olympiad. Since there are no more students, all 6 students managed to enter.
Explanation for the third example:
6 minutes before the start of the Olympiad, a group of three students enters the Olympiad.
4 minutes before, the remaining seven students wait.
3 minutes before, another group of three students can enter the Olympiad.
1 minute before, the remaining four students wait.
At 0 minutes, a group of three students enters the Olympiad.
Time is up, so 9 students entered.