I was solving the following problem. But I am not able to think of an efficient algorithm for this modified version of problem. The problem statement is:We are givenK Rectangles. The dimensions of xth Rectangle is (Nx * Mx)where 1top-right cornerand trashes the cut portion.Initially Alice placed a robot at thetop left cornerofeachrectangle. He is very interested to find thenumber of ways each robotcan reach the bottom-right corner (target) using the following rules:The number of ways can be very large. Thus Answer = (Number of ways) mod 10^9+7.Constraints is very large:1The Time Limit is just 1 second.Example:K=1
N1=2 M1=2
P1=1 Q1=1
Answer: 5 ways