From schweser Q bank - I am struggling with Investments in financial assets (FRA)

The question is asking how to calculate the Income for HFT securities.

I know dividends are included which is the sum of all Q’s = 2400

But how do we calculate the RGL and UGL. The schweser answer is giving me a headache: (Thanks in advance!)

*Trading income is calculated as dividends plus all gains and losses (realized and unrealized). Total dividends are 2,400. GLI realized a loss on the sale of 200 shares at 45.00 per share for a total realized loss of 1,000. GLI has an unrealized gain of 8,000 (800× (60-50)) on the shares purchased in Q1 and 10,500 (700× (60-45)) the shares purchased in Q3, or total unrealized gains of 18,500. Therefore, total income under the trading classification is 19,900 (2,400 - 1,000 + 18,500).*

**Exhibit 1 - Equity Portfolio Results**

*2013 Q1 2013 Q2 2013 Q3__2013 Q4* Shares purchased (sold) 1,000 (200) 700 0 Total shares quarter-end 1,000 800 1,500 1,500 Purchase price 50.00 45.00 Sale price 45.00 Quarter-end market price 52.00 43.00 52.00 60.00 Total dividends 500 400 750 750