# Nested sums and products

I am trying to determine how to express this series in a general form as a summation of products:

\begin{aligned} (p_{i1}p_{j1})(1-p_{i2}p_{j2})(1-p_{i3}p_{j3}) \mbox{ } &+ \\ (1-p_{i1}p_{j1})(p_{i2}p_{j2})(1-p_{i3}p_{j3}) \mbox{ } &+ \\ (1-p_{i1}p_{j1})(1-p_{i2}p_{j2})(p_{i3}p_{j3}) \end{aligned}

I am not sure whether it would be

$$\sum^x\prod^k(p_{ix}p_{jx})(1-p_{ik}p_{jk}) \mbox{, where } x \neq k$$

or

$$\sum^x(p_{ix}p_{jx})\prod^k(1-p_{ik}p_{jk}) \mbox{, where } x \neq k$$

or maybe something else.

-