Exercise R.4.2
Expected value: r(s,a) from the four-argument p
Show that \(r(s,a)=\sum_r r \sum_{s'} p(s', r \mid s,a)\).
Hint: apply the definition of expected value, then use the conversion from the three-argument to the four-argument function by getting the marginal of the reward.