corporation shall be reduced (but not below zero) by the amount of such United States shareholder’s aggregate foreign E&P deficit which is allocated under paragraph (2) to such deferred foreign income corporation. (2) Allocation of aggregate foreign E&P deficit The aggregate foreign E&P deficit of any United States shareholder shall be allocated among the deferred foreign income corporations of such United States shareholder in an amount which bears the same proportion to such aggregate as— (A) such United States shareholder’s pro rata share of the accumulated post-1986 deferred foreign income of each such deferred foreign income corporation, bears to (B) the aggregate of such United States shareholder’s pro rata share of the accumulated post-1986 deferred foreign income of all deferred foreign income corporations of such United States shareholder. (3) Definitions related to E&P deficits For purposes of this subsection— (A) Aggregate foreign E&P deficit The term aggregate foreign E&P deficit means, with respect to any United States shareholder, the aggregate of such shareholder’s pro rata shares of the specified E&P deficits of the E&P deficit foreign corporations of such shareholder. (B) E&P deficit foreign corporation The term E&P deficit foreign corporation means, with respect to any taxpayer, any specified foreign corporation with respect to which such taxpayer is a United States shareholder, if— (i) such specified foreign corporation has a deficit in post-1986 earnings and profits, and (ii) as of November 2, 2017— (I) such corporation was a specified foreign corporation, and (II) such taxpayer was a United States shareholder of such corporation. (C) Specified E&P deficit The term specified E&P deficit means, with respect to any E&P deficit foreign corporation, the amount of the deficit referred to in subparagraph (B). (4) Netting among United States shareholders in same affiliated group (A) In general In the case of any affiliated group which includes at least one E&P net surplus shareholder and one E&P net