Eh, it doesn’t matter how old the people are, really. They have all already gotten to experience the joy of life. The baby hasn’t, so they have the most to lose.
It does matter. Five young people have been fully invested in & will now produce value for the next few decades. Whereas a baby has still not been fully invested in, years of education etc, so they're cheaper to replace
the baby (young enough) doesn't understand the situation
also, you can easily flip it: elderly cannot be saved from the torture of existence, having lived so long, but the baby has barely suffered anything yet - we can save it!
The elderly also have wisdom to offer. The baby only has potential wisdom. Of course, if you're trading on potential, the baby could potentially grow up to be a serial killer. Or the elderly could potentially be mute.