시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 1 1 1 100.000%

문제

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:

  • $t$ --- the number of students;
  • $n$ --- the number of lectures;
  • $a$ --- the size of the first auditorium;
  • $b$ --- the size of the second auditorium;
  • $k$ --- the minimal number of lectures to pass the course.

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.

예제 입력 1

10 3 4 4 3

예제 출력 1

4

예제 입력 2

10 3 4 4 5

예제 출력 2

0

예제 입력 3

100000 100000 100000 100000 1

예제 출력 3

100000

예제 입력 4

5 4 5 3 3

예제 출력 4

5

예제 입력 5

100 9 6 3 6

예제 출력 5

7

힌트

In the fourth sample, 5 students can pass the course. Here's one possible strategy:

  1. Students $1$, $2$, $3$, $4$, $5$ visit the first lecture.
  2. Students $1$, $3$ visit the second lecture.
  3. Students $1$, $2$, $3$, $4$, $5$ visit the third lecture.
  4. Students $2$, $4$, $5$ visit the fourth lecture.

This way each of these 5 students can attend at least 3 lectures.