#K84412. Minimum Time Required to Reach Destination G
Minimum Time Required to Reach Destination G
Minimum Time Required to Reach Destination G
In this problem, \(M\) people must travel from Town A to Town G through a sequence of transportation modes: Plane, Train, Boat, Car, Bicycle, and Foot. Each leg has a throughput limit per minute represented by \(P\), \(Q\), \(R\), \(S\), \(T\), and \(U\) respectively.
Since the overall journey is constrained by the bottleneck (i.e. the slowest segment), the minimum time required for all people to reach Town G is determined by the formula:
\[ \lceil \frac{M}{\min(P, Q, R, S, T, U)} \rceil \]Your task is to compute and output this minimum number of minutes.
inputFormat
The input consists of a single line containing seven space-separated integers:
- \(M\): the number of people.
- \(P\): maximum number of people per minute from Town A to B (Plane).
- \(Q\): maximum number of people per minute from Town B to C (Train).
- \(R\): maximum number of people per minute from Town C to D (Boat).
- \(S\): maximum number of people per minute from Town D to E (Car).
- \(T\): maximum number of people per minute from Town E to F (Bicycle).
- \(U\): maximum number of people per minute from Town F to G (Foot).
Example: 8 4 3 2 5 2 3
outputFormat
Output a single integer representing the minimum number of minutes required for all \(M\) people to reach Town G.
## sample8 4 3 2 5 2 3
4