You are given a 2−D matrix of length n and width m. There is exactly one blocked cell in a 2D matrix that is uniformly chosen among all points except (1,1) and (n,m).
Find the expected number of paths from (1,1) to (n,m). You can only move rightwards and downwards. If the expected number of paths is pq in the simplest form, then print (p.q−1) modulo 1000000007 where q−1 is the multiplicative inverse of q modulo 1000000007.
Input format
Output format
For each test case, print a single line containing one integer (p.q−1) modulo 1000000007 where pq is the expected number of paths.
When cell (1,2) is blocked there is exactly one path from (1,1) to (2,2).
When cell (2,1) is blocked there is exactly one path from (1,1) to (2,2).
Therefore, expected number of path is 1.