Two train start at the same time from two stations and proceed towards each other with speeds 40 km per hour and 45 km per hour respectively. When they meet, it is found that one train has travelled 40 km more than other. Find the distance between the two stations.