Let the original speed of the train be S km/hr and the total distance be D km. In the first scenario, the train travels 30 km at S km/hr and the remaining distance of (D minus 30) km at four-fifths of S, causing a 45-minute delay. In the second scenario, the defect occurs after 48 km, meaning the train travels (D minus 48) km at the reduced speed, making it 9 minutes less late than the first scenario, for a net delay of 36 minutes. The difference in distance traveled at the reduced speed between the two scenarios is 48 km minus 30 km, which equals 18 km. Traveling this 18 km at the original speed instead of the reduced speed of four-fifths S creates a time difference of 9 minutes (or 0.15 hours), so the equation is 18 divided by (four-fifths of S) minus 18 divided by S equals 0.15. Solving this yields a speed of 30 km/hr, and substituting this back into the first scenario's delay equation confirms the total distance is 120 km.