#C5281. Maximum Number of Toy Cars

    ID: 48913 Type: Default 1000ms 256MiB

Maximum Number of Toy Cars

Maximum Number of Toy Cars

You are given the number of wheels, windows, and chassis. Each toy car requires exactly $4$ wheels, $2$ windows, and $1$ chassis. Your task is to determine the maximum number of toy cars that can be built with the given resources.

For instance, if you have 10 wheels, 8 windows, and 3 chassis, you can build 2 toy cars because the limiting resource is wheels (only 2 full sets of 4 can be formed) and chassis (only 3 available). In this example, the number of cars is min(⌊10/4⌋, ⌊8/2⌋, 3) = min(2, 4, 3) = 2.

The formula to calculate the maximum number of toy cars is:

$\text{result} = \min\left( \left\lfloor \frac{\text{wheels}}{4} \right\rfloor, \left\lfloor \frac{\text{windows}}{2} \right\rfloor, \text{chassis} \right)$

inputFormat

The input is provided via standard input (stdin) as a single line containing three space-separated integers, representing the number of wheels, windows, and chassis respectively.

For example:

10 8 3

outputFormat

Output the maximum number of toy cars that can be built. The output should be printed to standard output (stdout) as a single integer.

For example:

2
## sample
10 8 3
2