Compound interest is calculated using the formula: A = P(1 + r/n)^(nt) + PMT × [((1 + r/n)^(nt) - 1) / (r/n)] × (1 + r/n × type)
Where: A = final amount, P = principal, r = annual interest rate, n = number of times interest is compounded per year, t = time in years, PMT = regular contribution, type = 1 for beginning of period, 0 for end