I love these questions and they are actually very easy and just require practice.
You know that D = R * T is your formula and you have it twice and just need to manipulate it.
2 things you know to start, the T is the same for both trains, and the D1 + D2 = 408.
Your first train is D1 = 90 * T
Your second train is D2 = 80 * T
Remember your D1 + D2 = 408 so let's solve for D1
D1 = 408 - D2
Now go back to your first equation is substitute
408 - D2 = 90 * T
Guess what, you have D2 already in terms of T on your second equation so let's substitute again and solve for T
408 - (80 * T) = 90 * T
408 - 80*T = 90*T
408 = 170*T
T = 408/170
T = 2.4 and that is in hours
ALWAYS go back and check by putting your answer in each original equation
D1 = 90*T
D1 = 90*2.4 = 216 miles
D2 = 80*T
D2 = 80*2.4 = 192 miles
216+192 = 408 miles!
All the best
Lori