the W–2 wages of the partnership or S corporation for the taxable year (as determined under regulations prescribed by the Secretary). (B) Trusts and estates In the case of a trust or estate— (i) the items referred to in subparagraph (A)(ii) (as determined therein) and the W–2 wages of the trust or estate for the taxable year, shall be apportioned between the beneficiaries and the fiduciary (and among the beneficiaries) under regulations prescribed by the Secretary, and (ii) for purposes of paragraph (2), adjusted gross income of the trust or estate shall be determined as provided in section 67(e) with the adjustments described in such paragraph. (C) Regulations The Secretary may prescribe rules requiring or restricting the allocation of items and wages under this paragraph and may prescribe such reporting requirements as the Secretary determines appropriate. (2) Application to individuals In the case of an individual, subsection (a)(2) shall be applied by substituting adjusted gross income for taxable income . For purposes of the preceding sentence, adjusted gross income shall be determined after application of sections 86, 135, 137, 219, 221, 222, and 469. (3) Special rule for affiliated groups (A) In general All members of an expanded affiliated group shall be treated as a single corporation for purposes of this section. (B) Expanded affiliated group For purposes of this section, the term expanded affiliated group means an affiliated group as defined in section 1504(a), determined— (i) by substituting more than 50 percent for at least 80 percent each place it appears, and (ii) without regard to paragraphs (2) and (4) of section 1504(b). (C) Allocation of credit Except as provided in regulations, the credit under subsection (a) shall be allocated among the members of the expanded affiliated group in proportion to each member’s respective amount (if any) of qualified medical and drug manufacturing income. (4) Trade or business requirement This section shall be applied by only taking into account items which are