The basic idea is: the paths through the column vectors A, B, C, and D with zero sum can be found by first counting the paths halfway through with sum A[i] + B[j] and then checking if their additive inverses exist as C[k] + D[l].