Artificial intelligent assistant

Accrued interest I know how to calculate accrued interest over time on an initial amount. However, my assignment has me artificially adding additional sums intermittently. I'm curious if there is a formula to do that. The specific task is to calculate: $\$7000$ is invested at the beginning of each year for $25$ years with an annual interest of $7$%. Find the sum of the payments over the entire investment period.

This may be handled simply with a geometric series. Let $P$ be the amount invested every year, $i$ be the interest rate, and $N$ be the number of years of the investment period. Then treat each investment at the beginning of the year separately. Thus, the sum $S$ is

$$S = P\left (1+i\right)^n + P\left (1+i\right)^{n-1} + \cdots P\left (1+i\right)$$

This assumes that we are evaluating the sum at the end of a year. Using the formula for a geometric series, I get

$$S=P \left(1+i\right) \frac{\left(1+i\right)^n-1}{i} $$

Plug in $P=\$7000$, $i=0.07$, $n=25$. I get $S \approx \$ 473735$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 32bf2fac42e75ee06bef5bc0b876d2a7