recall your d = rt, distance = rate * time.
bear in mind that, say if the still air speed of the plane is say "p", and the wind has a speed of say "w", when the plane is going with the wind is not really going at "p" mph, is going at "p + w" mph.
likewise, when the plane is going against the wind, is not going "p" mph either, is really going "p - w", because the wind is eroding speed from it.

so, what's the speed of the wind anyway? well, w = p - 581.