Heinz has been contributing $300 at the end of each month for the past 15 months to a sivings plan that earns 6% compounded monthly. What amount will he have 1 year from now if he continues the plan?

I'm not sure how to get the answer for this question which is:

$8649.11

Sn = D[(1+i)^n-1)/i where

Sn = the accumulated sum over n interest periods
D = the periodic deposit
i = the periodic interest paid = I%/100n
n = the number of interest bearing periods

The total interest beariing period is 15 + 12 months
The monthly interest is 6/100(12) = .005
The monthly deposit is $300

Therefore,
S(27)=300[(1.005)^27-1]/.005= $8,649.11