In the taxable year when paid, in an amount determined in accordance with paragraph (1), if the contributions are paid toward the purchase of retirement annuities, or retirement annuities and medical benefits as described in section
401
(h), and such purchase is part of a plan which meets the requirements of section
401
(a)(3), (4), (5), (6), (7), (8), (9), (11), (12), (13), (14), (15), (16), (17), (19), (20), (22), (26), (27), (31), and (37) and, if applicable, the requirements of section 401(a)(10) and of section
401(d), and if refunds of premiums, if any, are applied within the current taxable year or next succeeding taxable year toward the purchase of such retirement annuities, or such retirement annuities and medical benefits.