By using the redstone statements on the sign, you can completely control what direction to send the train to: