An optical gate for simultaneous fusion of four photonic W or Bell states