accounts (other than a rollover contribution described in section 220(f)(5), 223(f)(5), or 530A(e)(5)), and (2) the amount determined under this subsection for the preceding taxable year, reduced by the sum of— (A) the distributions out of the accounts which were included in gross income under section 530A(e)(2), and (B) the excess (if any) of— (i) the maximum amount allowable as a contribution under section 530A(b) for the taxable year, over (ii) the amount contributed to the accounts for the taxable year. For purposes of this subsection, any contribution which is distributed out of the Roth HSA in a distribution to which section 530A(e)(3) applies shall be treated as an amount not contributed. . (9) Section 4975(c) of such Code is amended by adding at the end the following new paragraph: (7) Special rule for Roth HSAs An individual for whose benefit a Roth HSA (within the meaning of section 530A(c)) is established shall be exempt from the tax imposed by this section with respect to any transaction concerning such account (which would otherwise be taxable under this section) if, with respect to such transaction, the account ceases to be a Roth HSA by reason of the application of section 530A(c)(5) to such account. . (10) Section 6051(a)(12) of such Code is amended by inserting and to any Roth HSA (as defined in section 530A(c)) after 223(d)) . (11) Section 6693(a)(2) of such Code is amended by striking and at the end of subparagraph (E), by striking the period at the end of subparagraph (F) and inserting , and , and by adding at the end the following new subparagraph: (G) section 530A(g) (relating to Roth HSAs). . (d) Clerical amendment The table of parts for subchapter F of chapter 1 of such Code is amended by adding at the end the following new item: Part IX. Roth health savings accounts . (e) Effective date The amendments made by this section shall apply to taxable years beginning after December 31, 2016. 202. Treatment of direct primary care (a) HSAs (1) Roth HSA Section 530A(c)(2)(A) of the Internal