My task is to count number of different paths from A to B, moving only down or right so that path does not pass through walls on picture below.
So, in both of these walls we have $4$ segments. For the top right one I tried to find all paths that pass through segment $i(i=1,2,3,4)$.
Let $A_i$ be number of paths that pass through segment $i$ for the top wall.
Now, I've found cardinality of those $4$ sets, and got following results: $|A_1|$ = $5 \choose 4$ $9 \choose 4$ $|A_2|$ = $7 \choose 4$ $8 \choose 3$ $|A_3|$ = $8 \choose 5$ $7 \choose 3$ $|A_4|$ = $9\choose 5$ $5 \choose 4$
For the next part, using inclusion exclusion formula, I should find intersection of all combinations of $2,3$ and $4$ sets, but not sure how to do that. For the cardinalities above I first found path from A to starting point of segment, and then from end point of segment to B(without that segment). Any idea how to continue?