#K74397. Meeting Time on a Circular Track
Meeting Time on a Circular Track
Meeting Time on a Circular Track
Three friends are running on a circular track with a total length of L units. Friend A, Friend B, and Friend C run with speeds vA, vB, and vC respectively. They start at the same point and run in the same direction. Your task is to compute the time when they will all meet again at a single point on the track.
The meeting time can be computed using the formula:
\( T = \frac{L \times \mathrm{lcm}(v_A, v_B, v_C)}{\gcd(L, \mathrm{lcm}(v_A, v_B, v_C))} \)
Here, \( \mathrm{lcm} \) represents the least common multiple and \( \gcd \) represents the greatest common divisor.
inputFormat
The input consists of a single line containing four space-separated integers: L vA vB vC, where:
- L (1 ≤ L ≤ 109): the total length of the circular track.
- vA, vB, vC (1 ≤ vi ≤ 109): the speed of each friend.
outputFormat
Output a single floating-point number denoting the time when all three friends meet at one point. The answer should be computed exactly according to the given formula.
## sample12 3 2 1
12.0