In the case of a real estate investment trust (as defined in section
856), the difference between the amounts described in subparagraphs (A) and (B) of subsection (a)(1) shall be reduced to the extent that a capital gain dividend (as defined in section
857
(b)(3)(C), applied without regard to this section) is treated as paid out of such difference. Any capital gain dividend treated as having been paid out of such difference to a shareholder which is an applicable corporation retains its character in the hands of the shareholder as gain from the disposition of section
1250 property for purposes of applying subsection (a)(1) to such shareholder.