Environmental signal integration by a modular AND gate