Suppose there is a h × w grid consisting of empty or full cells. Let's make some definitions:
In other words, the i-th row starts exactly with r_i full cells. Similarly, the j-th column starts exactly with c_j full cells.
You have values of r and c. Initially, all cells are empty. Find the number of ways to fill grid cells to satisfy values of r and c. Since the answer can be very large, find the answer modulo 1000000007\,(10^9 + 7). In other words, find the remainder after division of the answer by 1000000007\,(10^9 + 7).
Input
The first line contains two integers h and w (1 ≤ h, w ≤ 10^3) — the height and width of the grid.The second line contains h integers r_1, r_2, …, r_h (0 ≤ r_i ≤ w) — the values of r.The third line contains w integers c_1, c_2, …, c_w (0 ≤ c_j ≤ h) — the values of c.
Output
Print the answer modulo 1000000007\,(10^9 + 7).
Examples
Note
In the first example, this is the other possible case. In the second example, it's impossible to make a grid to satisfy such r, c values.In the third example, make sure to print answer modulo (10^9 + 7).