loss— (A) shall be a carryback to each of the 3 taxable years preceding the loss year, and (B) to the extent that, after the application of paragraphs (2) and (3), such loss is allowed as a carryback to any such preceding taxable year, the amount so allowed shall be treated as a long-term capital loss. (2) Amount carried to each taxable year The entire amount of the net marked-to-market loss for any loss year shall be carried to the earliest of the taxable years to which such loss may be carried back under paragraph (1). The portion of such loss which shall be carried to each of the 2 other taxable years to which such loss may be carried back shall be the excess (if any) of such loss over the portion of such loss which, after the application of paragraph (3), was allowed as a carryback for any prior taxable year. (3) Amount which may be used in any prior taxable year An amount shall be allowed as a carryback under paragraph (1) from a loss year to any prior taxable year only to the extent— (A) such amount does not exceed the net marked-to-market gain for such prior year, and (B) the allowance of such carryback does not increase or produce a net operating loss (as defined in section 172(c)) for such year. (4) Net marked-to-market loss For purposes of this subsection, the term net marked-to-market loss means, with respect to any taxable year, an amount equal to— (A) the net capital loss for the taxable year determined by taking into account only marked-to-market gains and losses, reduced (but not below zero) by (B) the aggregate amount of gains from the sale or exchange of capital assets which are not marked-to-market gains. (5) Net marked-to-market gain For purposes of this subsection— (A) In general The term net marked-to-market gain means, with respect to any taxable year, an amount equal to— (i) the capital gain net income for the taxable year determined by taking into account only marked-to-market gains and losses, reduced (but not below zero) by (ii) the aggregate amount of losses from the sale or exchange