P.M.F and expected value/expected payout The question is: 

Let a random variable X be the number of days that a certain patient needs to be in the hospital. Suppose that X has the p.m.f.

$$\displaystyle f(x) = \frac{5 - x}{10}, \quad x = 1, 2, 3, 4 $$

If the patient is to receive 166 dollars from an insurance company for each of the first two days in the hospital and $118 for each day after the first two days, what is the expected payment for the hospitalization?

The given answer is 312.8
I got: 284.
How I got this: 
$$E(X) = 166(1(\frac{5-1}{10}) + 2(\frac{5-2}{10})) + 118(3(\frac{5-3}{10}) + 4(\frac{5-4}{10})$$
$$E(X) = 166(0.4 + 0.6) + 118(0.6 + 0.4) $$
$$E(X) = 166 + 118 = 284 $$
What am I doing wrong?
 A: There are a number of minor mistakes.
Part of your computation looks like the computation for "expected number of days."
$$1 \cdot \frac{5-1}{10} + 2 \cdot \frac{5-2}{10} + 3 \cdot \frac{5-3}{10} + 4 \cdot \frac{5-4}{10}.$$
You also seem to be computing "expected payment on the last day in the hospital."
$$166 \cdot \frac{5-1}{10} + 166 \cdot \frac{5-2}{10} + 188 \cdot \frac{5-3}{10} + 118 \cdot \frac{5-4}{10}.$$
But neither of these is what the question is asking.
$$E[X] = \sum_{n=1}^4 (\text{total cost of $n$ days}) \cdot P(\text{$n$ days in hospital})$$
For example, the cost of $3$ days is $166+166+118$.
A: 
What am I doing wrong?

$$E(X) = 166( 1(\frac{5-1}{10}) +  2(\frac{5-2}{10})) + \underbrace{118( 3(\frac{5-3}{10}) +  4(\frac{5-4}{10}))}$$
If you spend three or four days in the hospital, you pay \$166 for each of the first two days and \$118 for the remainder.   Not $118 for each of the days.
$$E(X) = 166( 1(\frac{5-1}{10}) +  2(\frac{5-2}{10})) + (166\cdot 2+118)(\frac{5-3}{10}) +  (166\cdot 2+118\cdot 2)(\frac{5-4}{10})$$
