§ 118. Qualification on residence. The continuous residence required to acquire state residence or to establish liability for payment for hospital or other institutional care shall not include any period during which the person was (a) a patient in a hospital, or

(b) an incarcerated individual of any public institution or any incorporated private institution, or

(c) if a child under the age of twenty-one years, in a boarding home under the care of an authorized agency, or

(d) residing on any military reservation. If, however, the periods of residence immediately prior and subsequent to the period specified in a, b, c, or d, shall together equal the required period of residence, such person shall be deemed to have had the required continuous residence.