A distribution of property made by an S corporation with respect to its stock to which (but for this subsection) section 301(c) would apply shall be treated in the manner provided in subsection (b) or (c), whichever applies.
The distribution shall not be included in gross income to the extent that it does not exceed the adjusted basis of the stock.
That portion of the distribution which does not exceed the accumulated adjustments account shall be treated in the manner provided by subsection (b).
That portion of the distribution which remains after the application of paragraph (1) shall be treated as a dividend to the extent it does not exceed the accumulated earnings and profits of the S corporation.
Any portion of the distribution remaining after the application of paragraph (2) of this subsection shall be treated in the manner provided by subsection (b).
Except as otherwise provided in this paragraph, the term “accumulated adjustments account” means an account of the S corporation which is adjusted for the S period in a manner similar to the adjustments under section 1367 (except that no adjustment shall be made for income (and related expenses) which is exempt from tax under this title and the phrase “(but not below zero)” shall be disregarded in section 1367(a)(2)) and no adjustment shall be made for Federal taxes attributable to any taxable year in which the corporation was a C corporation.
In the case of any redemption which is treated as an exchange under section 302(a) or 303(a), the adjustment in the accumulated adjustments account shall be an amount which bears the same ratio to the balance in such account as the number of shares redeemed in such redemption bears to the number of shares of stock in the corporation immediately before such redemption.
The term “S period” means the most recent continuous period during which the corporation has been an S corporation. Such period shall not include any taxable year beginning before January 1, 1983.
An S corporation may, with the consent of all of its affected shareholders, elect to have paragraph (1) of subsection (c) not apply to all distributions made during the taxable year for which the election is made.
For purposes of subparagraph (A), the term “affected shareholder” means any shareholder to whom a distribution is made by the S corporation during the taxable year.