The fly between two trains
Asked at Jane Street, SIG
Two trains are miles apart on the same track, heading straight toward each other. Each travels at miles per hour. At the instant they start moving, a fly leaves the front of one train and flies at miles per hour toward the other. As soon as it reaches the second train it instantly turns around and flies back, and it keeps bouncing between the two trains until they collide (squashing the fly).
What is the total distance the fly travels?
Show a hint
Don't sum the infinite series of ever-shorter bounces. Ask instead: how long is the fly in the air?