Correct answer: Within 50 feet but not less than 15 feet from the nearest rail
Stop within 50 feet, but not less than 15 feet, from the nearest rail when signals flash, gates are down, a flagman signals, or a train is near.
Source: Section 5: Traffic Laws – Railroad Crossings