Buying on margin question

I came across the problem during a practice exam.

An investor buys a stock on margin. Assume that the interest on the loan and the dividend are both paid at the end of the holding period. The data related to the transaction are as follows:

Number of shares

500

Purchase price per share

$28

Leverage ratio

3.33

Commission

$0.05/share

Position holding period

Six months

Sale price per share

$30

Call money rate

5% per year

Dividend

$0.40 / share

The investor’s total return on this investment over the margin holding period is closest to:

A) 16.7% B) 21.4% C) 15.6% Here are the steps I took to solve it Initial investment= (28*500*(1/3.33)) + (500*.05)= 4229 - commission .05*500 -25 + gain (30-28)*2 +1000 - interest (500*28*(1-(1/3.33)))*.025 -245 +dividends 0,40*500 +200 - commission .05*500 -25 = 5134 (5134-4229)/4229= 21.4% This process is through memorization. Can someone explain WHY You add the commission towards the initial investment, only to deduct it on the next step? Thanks in advance!