<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def addReward(self, r=None):
 """ A filtered mapping towards performAction of the underlying environment. """

        r = self.getReward() if r is None else r

        # by default, the cumulative reward is just the sum over the episode
        if self.discount:
            self.cumulativeReward += power(self.discount, self.samples) * r
        else:
            self.cumulativeReward += r