Let T represent the time going from A to B.
The distance = rate x time ---> distance = 40·T
Since the total time was 5.5 hrs, the time returning from B to A was 5.5 - T hours.
The distance returning ---> distance = 70·(5.5 - T)
Since the distance going is the distance returning: 40·T = 70·(5.5 - T)
Solving: 40T = 385 - 70T
110T = 385
T = 3.5 hours
The distance going = 40·3.5 = 140 km
The distance returning = 70·2 = 140 km