https://imgur.com/a/cUsG89e
The question asks "frequency at the instant", at that particular instant it would have received a frequency which train S1 would have emitted at time (say t) ago, and in this time t the train would have covered a distance 30t and would have reached at the the particular instant which question is talking about, so technically shouldn't we have been applying doppler's effect for train S1 t seconds ago?