For the really bored:
This problem is a geometric series/progression,
initial amount (P) is invested for n years, r being the interest rate (decimal - e.g. .05 for 5%)
end value of initial amount = P(1+r)^n
assume your yearly saved amount (v) is invested at the start of each year (problem is slightly different for end of year investment, just divide (Z) below by (1+r))
1st year savings = v(1+r)^n
2nd year savings = v(1+r)^(n-1)
3rd year savings = v(1+r)^(n-2)
.
(n-1)th year savings = v(1+r)^(n-(n-2)) = v(1+r)^2
nth year savings = v(1+r)^(n-(n-1)) = v(1+r)^1
If we reverse the order, you can see that each amounted is invested for (1+r) times more than the next year (basic compounding).
sum of all yearly savings is a geometric progression. For simplicity, take the 1st term (A) as v(1+r)^1 and the multiplyer as (1+r) for n years.
Sum (Z) = A(((1+r)^n)-1)/(r)
=
Total = P + Z