It took 2 minutes for the train to pass through the first tunnel (front entrance and back exit).
The length of the first tunnel is 2× 1000.
-
540 =1460m
It took 2.5 minutes to cross the second tunnel.
The length of the second tunnel is 2.5× 1000.
-
540 =1960m
It took six minutes for the locomotive to enter the first tunnel and the rear to leave the second tunnel.
Then the distance between the two tunnels is 6× 1000.
-540-1460-1960 = 2040m