The total of the amounts which are treated under section
666 as having been distributed by a trust in a preceding taxable year shall be included in the income of a beneficiary of the trust when paid, credited, or required to be distributed to the extent that such total would have been included in the income of such beneficiary under section
662
(a)(2) (and, with respect to any tax-exempt interest to which section
103 applies, under section
662
(b)) if such total had been paid to such beneficiary on the last day of such preceding taxable year. The tax imposed by this subtitle on a beneficiary for a taxable year in which any such amount is included in his income shall be determined only as provided in this section and shall consist of the sum of—