Given this circuit:

http://img9.imageshack.us/img9/7859/circa.jpg

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))$