Skip to main content
Back to problems
Codeforces
Easy
Math
Simulation
Soft Drinking

Compute how many toasts each friend can make based on available drink, lime, salt, and required usage per toast.

Acceptance 0%
Problem Statement

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:

  • nn — number of friends
  • kk — number of bottles of drink
  • ll — milliliters of drink in each bottle
  • cc — number of limes
  • dd — number of lime wedges in each lime
  • pp — grams of salt
  • nlnl — milliliters of drink needed per toast for each friend
  • npnp — 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.
  • n,k,l,c,d,p,nl,npn, k, l, c, d, p, nl, np fit within typical 32-bit integer ranges.
  • The answer is always an integer.
Examples
Sample cases returned by the problem API.

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.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.