I tried to answer the question:
Using F=ma, I got an acceleration of 5000/3000 = 1.666ms^-2.
Why is this wrong?
A diagram (right) is shown for this situation.
(Note that, for simplicity, the normal reaction force is not shown)
The weight force W has been resolved into components parallel and perpendicular to the slope (shown in blue).
The resultant force that acts to accelerate the train is (F - Wsin5°) Newtons.
You were correct to use the "F=ma" formula, but the "F" in the formula is the resultant force, not the F of the diagram:
And if g = 9.8ms-2,