If you're coming back then the distance between A and B is largely irrelevant.
distance =speed*time, so
ground speed out *time out=ground speed back*time back, since the distance is the same both ways, and since time back is (8.5-time out) then:-
365*To=480*(8.5-To)
This is basic secondary school maths, you're going to struggle with other parts of the course, or are we doing your homework for you?