Given this circuit:

I need to find a logical formula.

I came up with this:

$\displaystyle (\neg (\neg p \wedge q)) \wedge (\neg (\neg p \wedge r) \vee s)))$

Is this correct? Can you simplify it to this?

$\displaystyle (p \wedge \neg q) \wedge ((p \wedge \neg r) \vee s))$