Change values of resistors as needed to change from AND to OR gates. Swap Inverting and Non Inverting inputs to change to NOR NAND gates. These gates use voltage addition on the inputs to switch the Op Amp when the Sum of input voltages becomes greater than the reference voltage.