NAND gate response in a mesoscopic ring: an exact result