Tom has a scientific calculator. Unfortunately, all keys are broken except
for one row: 1, 2, 3, + and −. Tom presses a sequence of 5 random
keystrokes; at each stroke, each key is equally likely to be pressed. The
calculator then evaluates the entire expression, yielding a result of E. Find
the expected value of E. (Note: Negative numbers are permitted, so
13 − 22 gives E = −9. Any excess operators are parsed as signs, so
−2 − +3 gives E = −5 and − + −31 gives E = 31. Trailing operators are
discarded, so 2 + + − + gives E = 2. A string consisting only of operators,
such as − + + − +, gives E = 0.)
The key observation is that any sign can be flipped
This will essentially eliminate any terms that come after a sign from
the calculation of the expected value.
Thus, we just want to find the e