project under this subsection ends because the State in which such political subdivision is located elects to provide for medical assistance under the State plan (or a waiver of such plan) for individuals described in subclause (VIII) of subsection (a)(10)(A)(i), such State shall automatically enroll under such State plan (or waiver) any eligible and enrolled individual so described receiving medical assistance from such political subdivision and coverage for such individual under such State plan (or waiver) beginning with the first day on which the State provides medical assistance under such State plan (or waiver) for individuals described in subclause (VIII) of subsection (a)(10)(A)(i). (5) Payments (A) In general The Secretary shall pay a participating political subdivision the Federal matching percentage specified in subparagraph (B) for amounts expended by such political subdivision to provide medical assistance for individuals described in subclause (VIII) of subsection (a)(10)(A)(i). (B) Calculation of Federal and non-Federal share Except as provided under clause (ii) and subparagraph (C), the calculation and payment of the Federal and non-Federal share of expenditures for medical assistance under a demonstration described in paragraph (1) shall be calculated in accordance with section 1903 as if the qualifying political subdivision was a State. (C) Federal matching percentage The Federal matching percentage specified in this subparagraph, with respect to a participating political subdivision and the demonstration project under this subsection, is— (i) 100 percent for calendar quarters in the first three years that such political subdivision participates in such demonstration project, if applicable