the possibility of its reward continuing. Thus, the reward belongs to the builder of the first mosque for the period during which the first mosque would likely have remained standing. As for anything beyond that, its reward belongs to the owner of the second mosque. Likewise, if the second mosque is more beneficial due to air-conditioning or the like, then the reward for that additional benefit belongs to the second endower.
Note: A discontinued endowment is one in which the beneficiaries of the endowment cease to exist. For example, someone endows something to Zayd and then to ‘Amr, and Zayd dies and ‘Amr dies. The designated beneficiaries have now ceased to exist. There is a difference of opinion regarding this case. The view that appears closest to correct to me is that, if it is known that the endower intended righteousness and reward, the discontinued endowment reverts to the poor or to matters of public benefit.