Bessie and her friends have been captured and are locked in a secret compound far from their farm, and it is up to Bessie to plan their escape! The compound consists of n \cdot k holding cells arranged in an n \times k rectangular grid, with gates between horizontally and vertically adjacent cells. Each cell holds exactly one cow.
Bessie has hacked into the security system and can unlock any subset of the gates, but unlocking each gate has a cost. For the cows to escape, Bessie must open enough gates so that all the cows can gather in a single cell (only then will they have enough cow-power to tunnel to the surface!). Bessie wants to minimize the total unlocking cost.
But the stakes are higher than ever, and Bessie cannot rely on just one escape plan: she needs backups. Help her count the number of minimum-cost escape plans. Two plans are considered different if some gate is unlocked in one of them but not in the other.
Since this number can be very large, output it modulo 10^9 + 7.
The first line contains two integers and k~(2 \le n \le 30000, 2 \le k \le 6).
Each of the next lines contains k - 1 integers: the -th of these lines gives the unlocking costs of the gates between horizontally adjacent cells in the -th row.
Each of the next lines contains n - 1 integers: the -th of these lines gives the unlocking costs of the gates between vertically adjacent cells in the -th column.
All costs are integers from to 10^9 inclusive.
Print one integer — the number of minimum-cost escape plans, taken modulo 10^9 + 7.
Example 1
The example describes a 4 \times 3 grid. In the figure below, the symbols '' denote the cells, and the lines between them denote the gates, labeled with their costs:
1 1
+-----+-----+
| | |
1 | |2 | 1
| 5 | 6 |
+-----+-----+
| | |
1 | |3 | 1
| 7 | 8 |
+-----+-----+
| | |
1 | |4 | 1
| | |
+-----+-----+
1 1Every minimum-cost escape plan uses the gate of cost , the gate of cost , and nine of the ten gates of cost . There are ten ways to choose which gate of cost is left locked, so the answer is .