Downstream speed = ship speed+current speed
Upstream speed = ship speed-current speed
Water velocity = (downstream velocity-upstream velocity) /2
Ship speed = (downstream speed+upstream speed) /2
So we can easily know the current speed = 20/2 =10 km/h.
The speed of downstream sailing is fast, and the speed of upstream sailing is slow, so there are both downstream sailing and upstream sailing in the first four hours, so downstream sailing is 60 kilometers more than upstream sailing, and downstream sailing is 20 kilometers more than upstream sailing.
So the sailing time: 60/20=3 hours.
The sailing time against current is 8-3=5 hours.
Think of the whole distance as 1.
Downstream sailing speed = 1/3
Countercurrent speed = 1/5
Then the whole journey = 20/(1/3-1/5) =150km.