In languages like Haskell and Scala that supports `do` / `for` comprehension sugar, this could be done without the nesting:
fn :: Maybe Int -> Maybe Int -> Int
fn q z = fromMaybe 0 $
do
q_in <- q
z_in <- z
return (q_in + z_in)