A train driver moving at 40 km/h applies brakes so that there is a constant retardation of 0.5 m/s^2. Find the time taken before the train stops.