A train 400 meter long overtook a man walking along the line in the same direction at a speed of 5 km/hr and passed him in 40 seconds. The train reached the station in 20 minutes after it had passed the man. In what time did the man reach the station?