Compute how many toasts each friend can make based on available drink, lime, salt, and required usage per toast.
Soft Drinking
Four friends want to make as many toasts as possible. Each toast requires some amount of drink, one slice of lime shared among all toasts, and a fixed amount of salt. Given the total available drink, the number of bottles, the amount in each bottle, the number of limes and their wedges, the amount of salt, and how many units of each ingredient are needed per toast, determine the maximum number of toasts the group can make.
For each ingredient, figure out how many toasts it can support, then take the smallest of the three values because every toast needs all required ingredients.
Input Format
The input consists of six integers:
- — number of friends
- — number of bottles of drink
- — milliliters of drink in each bottle
- — number of limes
- — number of lime wedges in each lime
- — grams of salt
- — milliliters of drink needed per toast for each friend
- — grams of salt needed per toast for each friend
(Any equivalent concise formulation is acceptable; the task is to compute the maximum number of toasts.)
Output Format
Print one integer — the maximum number of toasts each friend can make.
Constraints
- All values are non-negative integers.
- fit within typical 32-bit integer ranges.
- The answer is always an integer.
Example 1
Input
3 4 5 10 8 100 3 1
Output
2
Explanation
Total drink = 4×5 = 20, total lime wedges = 10×8 = 80, salt = 100. Toasts possible: drink 20/3 = 6, lime 80/1 = 80, salt 100/1 = 100. The limiting factor is drink, so each friend can make 2 toasts.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.