P27213 [AtCoder] Homework
普及
题目描述

Problem Description

JOI, who has always struggled with homework during winter vacations, has decided to plan his homework execution this time. His homework consists of language and math workbooks, with the language workbook having $A$ pages and the math workbook having $B$ pages.

JOI can complete up to $C$ pages of the language workbook and up to $D$ pages of the math workbook in one day. However, if he does his homework on a particular day, he cannot play on that day.

The winter vacation lasts for $L$ days, and JOI must finish his homework during this period. Write a program to determine the maximum number of days JOI can play during the winter vacation.


Input Format

The input consists of 5 lines, each containing one positive integer.

The first line contains the integer $L$ ($2 \leq L \leq 40$), representing the number of days in the winter vacation.
The second line contains the integer $A$ ($1 \leq A \leq 1000$), representing the number of pages in the language workbook.
The third line contains the integer $B$ ($1 \leq B \leq 1000$), representing the number of pages in the math workbook.
The fourth line contains the integer $C$ ($1 \leq C \leq 100$), representing the maximum number of pages JOI can complete in one day for the language workbook.
The fifth line contains the integer $D$ ($1 \leq D \leq 100$), representing the maximum number of pages JOI can complete in one day for the math workbook.

It is guaranteed that for the given input data, JOI can always finish his homework during the winter vacation and that he can play for at least one day.

Output Format

Output the maximum number of days JOI can play during the winter vacation on one line.


Sample Input and Output

Sample Input #1

20
25
30
6
8

Sample Output #1

15

Sample Input #2

15
32
48
4
6

Sample Output #2

7

Notes/Hints

Sample Explanation 1

In Sample Input #1, the winter vacation lasts for 20 days, with the language workbook having 25 pages and the math workbook having 30 pages. JOI can complete up to 6 pages of the language workbook and up to 8 pages of the math workbook in one day. For example, if JOI starts by completing 6 pages of the language workbook and 8 pages of the math workbook each day from the first day of the vacation, he can finish the language workbook on the 5th day and the math workbook on the 4th day, allowing him to play for 15 days. This is the maximum number of days JOI can play during the winter vacation, so output 15.


Sample Explanation 2

In Sample Input #2, for example, if JOI starts by completing 4 pages of the language workbook and 6 pages of the math workbook each day from the first day of the vacation, he can finish both workbooks on the 8th day, allowing him to play for 7 days. This is the maximum number of days JOI can play during the winter vacation, so output 7.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
20 25 30 6 8
样例输出
15