I'm working on a dynamic programming problem from a textbook. My solution is different from that given in the solution manual, and I'm looking for input as to which answer is correct.
The problem is to choose between two investments ($A$ and $B$) at the beginning of each year, over a three year period. You are "given" \$5000 to invest. You can make only one investment each year, and can only invest \$5000 each time (any extra money accumulated is left "idle"). The objective is to find an investment policy that maximizes the expected amount of money you will have after three years. The investment returns are in the table below.

My approach was to start in the last period ($n=3$). In this period, I will either: (1) have at least \$5000 so that I can make an investment, or (2) have no remaining capital and not be able to make an investment. In the second scenario I obviously don't have any decision to make. In the first scenario, the optimal choice would be $A$, as $$E(A)=0.3 \cdot 0 + 0.7 \cdot 10000 = 7000 > 5500 = 0.9 \cdot 5000 + 0.1 \cdot 10000 = E(B)$$ where $E(\cdot)$ is expected value. Now, the solution manual (which I found online, and contains lots of hand written answers) claims that this conclusion - that $E(A) > E(B)$ - means I should choose $A$ in every period. I don't think this is correct.
It ignores the expected returns from future periods. Investment $A$ may have higher expected returns in a single given period, but it also has the risk of zero return and hence the risk of not being able to invest in future periods.
In the second period, for example, suppose you have \$5000 to invest. The expected return of $A$ is: $$E(A) = 7000 + 0.7 \cdot 7000 = 11900,$$ where the second term captures the expected return of being able to invest in $A$ (the optimal choice) in period 3. The expected return of $B$, however, is $$E(B) = 5500 + 7000 = 12500,$$ because there will be enough money to invest in $A$ in period 3 with a probability of 1 ($B$ returns at least \$5000).
Am I correct? Any input appreciated and thanks.