Introducing , the first expectation becomes

and the second

Together this gives

where

and then finally

giving the overall function