Today Jin has given a task to Shino, Shino has to travel from cell to cell in a grid of size . But in order make this task interesting for Shino, Jin has decided to keep some special candies in some K special cells of the grid, where each candy has an amount of happiness associated with it.
Shino can travel only in right & down direction in the grid, as he is too careful & does not want to fall out of grid. Now, we call the value of a path the happiness of all cells lying on the path. All non-special cells have happiness equal to 0.
Now, you need to find and print the sum of the values of all paths from to , traveling only right and down to an adjacent cell.
As Shino is not good at counting help him find the answer.
Input Format
The first Line contains a single integer T denoting number of test cases
The next line contains 3 space separated integers, N, M and K where N * M is the size of grid & K denoting number of special cells
The next K lines contains three integers where is cell coordinate & is the amount of happiness Shino will get from a candy at cell
Constraints
Output Format
For each test case you will output a single integer denoting the total amount of happiness Shino will get. As the answer can be quiet large you can output answer modulo
.