#C6742. Cookie Batches

    ID: 50536 Type: Default 1000ms 256MiB

Cookie Batches

Maria wants to bake cookies. She has c cups of flour and s cups of sugar. Each complete batch of cookies requires a cups of flour and b cups of sugar. To successfully bake a complete batch, both resources must be available in sufficient quantity.

The maximum number of batches she can bake is given by the formula: $$\min\left(\left\lfloor \frac{c}{a} \right\rfloor, \left\lfloor \frac{s}{b} \right\rfloor\right)$$.

Your task is to compute this maximum value given the available resources.

inputFormat

The input consists of a single line with four integers separated by spaces: c s a b, where:

  • c is the number of cups of flour available.
  • s is the number of cups of sugar available.
  • a is the number of cups of flour required per batch.
  • b is the number of cups of sugar required per batch.

outputFormat

Output a single integer representing the maximum number of complete batches of cookies that can be baked with the available resources.

## sample
10 21 2 3
5

</p>