Advanced modified toffoli gate.