RANFR - Ranjan And Friends

Ranjan has invited N number of friends to his Birthday Party. It's too hot outside, so he decides to make lemonade at home. There are only A water bottles left with him each of B millilitres capacity and C limes, which he cut into D slices each. He also has E grams of sugar.

For each drink he needs F milliliters of water, a slice of lime and G grams of sugar. He wants to make as many drinks as possible. Provided that they (friends) all want to drink the same number of drinks. How many drinks can each friend have?

Note: Ranjan is not going to drink lemonade.

Input

Input contains 8 positive integers N, A, B, C, D, E, F, G separated by space.

Constraints

1 <= N, A, B, C, D, E, F, G <= 1000

Output

Output contains single integer - the number of drinks each friend can have.

Example

Input #1
1 7 4 5 5 8 3 2

Output #1
4
Input #2
2 3 3 5 5 10 1 3

Output #2
1

Explanation of the First Example

Overall Ranjan has 7 × 4 = 28 milliliters of the water, it is enough to make 28 / 3 = 9 drinks. The limes are enough for 5 × 5 = 25 drinks and the sugar is enough for 8 / 2 = 4 drinks. However, there is only 1 friend, so the answer is min(9, 25, 4) / 1 = 4.


Added by:Aditya Dixit
Date:2015-02-20
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.