40. A beneficiary who receives a pension of a smaller amount than he would receive but for the application of section 39 is entitled to withdraw, in accordance with section 24, the part of his contributions that corresponds to the ratio by which the pension credits exceed the amount of the pension granted to him.
The pension credits reduced or cancelled by the effect of the withdrawal of contributions shall be, first, those granted during the most recent year of service first and, then, those granted during each year preceding it.