Recall your d = rt, distance = rate * time
bearing in mind that the trip over, upstream, is the same distance as back, 280 miles.
if say, the boat has a speed rate of say "b", and the current has a speed rate of "c", so, when the boat was going upstream, it really wasn't going "b" fast, it was going "b-c" fast, because the stream is subtracting speed from it, because is going against the stream.
And when the boat was going downstream, is not going "b" fast either, is going "b+c" because, since it's going with the current, the current's rate is adding speed to it.
what's the speed of the boat? well, 40 - c = b.