computing reward