A boat's speed in still water is 4 km/h. The boat cruises from A to B along a river flowing at an average speed of x km/h in the direction A to B. If the distance AB is 5 km and the boat takes 2 hours more on its return journey, determine x. Hence, find the total time taken for the whole journey.​