A member who has additional contributions under Section 31627 of the Government Code, or under Section 31504 of the Government Code, may, within 30 days prior to retirement, elect in writing to have all or any part of his accumulated additional contributions returned to him. The portion returned shall not be included in the calculation of the member’s annuity.