If the 40 years of fasting that they missed was with a valid excuse, then all they need to do is pay a 'fidya' for each day. A fidyah is 3/4 of a kilo of food, given to poor.
If they did not have an excuse, then they must:
1. Repent to Allah ta'ala.
2. Pay kaffarah for each day. Kaffarah is feeding of 60 poor people (most common option).
3. Write in their will that they have this amount of qadha' fasting to be done once they die, either by their next of kin, or they pay someone who will fast as qadha` on their behalf.
Furthermore, from this holy month of Ramadhan, because they cannot fast, they can pay the fidyah.
And Allah knows best.