The speed going to B is x, the time t and the distance, 400 km.
xt=400, x kph and t in hours
on the way back, the 2x+(x+10)(t-7/3), where it was total time minus 2 hours already driven minus 1/3 of an hour, the 20 minutes.
2x+xt-(7/3)x+10t-70/3=400
2x+400-(7/3)x+10t-70/3=400, 400 cancels, t=400/x
-(1/3)x+4000/x=70/3
multiply by x
-(1/3)x^2-(70/3)x+4000=0
x^2+70x-12000=0
x=(1/2)(-70+/- sqrt 52900); sqrt term=230
x=80 kph
took 5 hours to go there
on way back 2 hours at 80 kph=160 km
2h40m at 90kph=90*8/3=240 km
They add to 400 km.
The return trip took 4h40m