Speed=distance/time, rearranging gives speed*time=distance therefore the first section of the journey yielded a total distance of 40km, the second journey was stated to be 20km which was completed in (20/30)*60=40minutes. Therefore the total journey was 60km which was completed in 1hr40 minutes so the average speed was (60/1.66..)=36km/h.