시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 16 | 8 | 8 | 53.333% |
There are $t$ students studying in the best university of Berland. They only study programming in Berland, so there is only one subject. Each student must attend the lectures.
The entire course consists of $n$ lectures. It is known that a student who visits at least $k$ of them will pass the course.
There are only two auditoriums in the university, one has space for $a$ people and the other one --- for $b$ people. To make it comfortable, the administration decided that in odd weeks the lectures will be in the first auditorium, and in the even weeks --- in the second auditorium. So the first lecture will be in the 1-st auditorium, the second lecture in the 2-nd one, the third in the 1-st one again, and so on.
The sizes of the auditoriums are small so it might not be possible for all students to attend at least $k$ lectures. They ask you to count the maximum number of students that can pass the course.
The first line contains five integers:
The limits are: $1 \leq t, n, a, b, k \leq 10^9$.
Print a single integer --- the maximal number of students that can attend at least $k$ lectures and thus pass the course.
10 3 4 4 3
4
10 3 4 4 5
0
100000 100000 100000 100000 1
100000
5 4 5 3 3
5
100 9 6 3 6
7
In the fourth sample, 5 students can pass the course. Here's one possible strategy:
This way each of these 5 students can attend at least 3 lectures.