Corrected the implementation of the R (reward) term of the submod
function.