Bavan is going to drive from city A to city B. He drives the first one-third of his trip at an average speed of 30 km h-1 and then the rest of the distance at an average speed of 40 km h-1. The total trip from A to B takes 4 hours. What is the distance between A and B in kilometres?