Contest Duration: - (local time) (300 minutes) Back to Home
B - Flowers /

Time Limit: 2 sec / Memory Limit: 1024 MB

制約

• 1 \leq A,B \leq 100
• 0 \leq X,Y \leq 100
• 入力は全て整数

A B X Y

3 2 6 4

2

3 3 100 0

0

5 10 30 23

2

Score : 8 points

Problem Statement

Takahashi wants to make many bouquets. Each bouquet should consist of A red flowers and B blue flowers.

Takahashi has X red flowers and Y blue flowers. How many bouquets can he make at most?

Constraints

• 1 \leq A,B \leq 100
• 0 \leq X,Y \leq 100
• All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B X Y

Output

Print the maximum number of bouquets that Takahashi can make.

3 2 6 4

Sample Output 1

2

He can make 2 bouquets.

3 3 100 0

0

5 10 30 23

2