Time limit: | 1 second |

Memory limit: | 64 megabytes |

Diffusion is the net movement of molecules or atoms from a region of higher concentration(or high chemical potential) to a region of lower concentration(or low chemical potential) by Brownian motion. Diffusion is driven by a gradient in chemical potential of the diffusing species. One of the most influential theory is Kinetic Theory of Gases.

In the present, there is a poison source in an enclosure space of two-dimension. Abnormally, the pressure of every area may not be uniform so that poison things are able to flow towards the neighbor with a less or equal(unavoidable) pressure. Glory has an air pump that has the ability to change the pressure of some areas. Take the tolerance of the whole space into consideration, he only decides to decrease some areas’ pressure and certainly not to subzero. Operations made in different areas might take different costs. Moreover, there are several directed pump tunnels joining two areas, which allow things moving from the starts to the ends regardless of their actual pressure. Of course, Glory’s team is qualified to destroy those tunnels but with a cost. Now he gives you an arduous task. You are asked to prevent poison things from reaching the area where important materials are stored with the lowest costs. Notice, you are not allowed to decrease the pressure of poison source or the storage area.

The input contains several test cases, where the number of test cases is up to 10.

For each test case, the first line contains three integers n, m and K, indicating the space consisting of n × m areas and the number of pump tunnels respectively, where 1 ≤ n,m ≤ 50 and 0 ≤ K ≤ 100.

The next line contains four positive integers x_{S}, y_{S}, x_{T } and y_{T }, representing the poison
source (x_{S},y_{S}) and the storage area (x_{T },y_{T }) respectively, where 1 ≤ x_{S},x_{T } ≤ n and
1 ≤ y_{S},y_{T } ≤ m.

Each of the following n lines contains m non-negative integer indicating the initial pressure of
n × m areas, denoted by w_{1,1},w_{1,2},w_{1,m},…,w_{2,1},w_{2,2},…,w_{n,m}, where 0 ≤ w_{i,j} ≤ 200 000.

And then each of the following n lines contains m non-negative integer indicating the cost of
utilizing the pump to decrease unit pressure of n × m areas, denoted by c_{1,1},c_{1,2},c_{1,m},
…,c_{2,1},c_{2,2},…,c_{n,m}, where 1 ≤ c_{i,j} ≤ 100.

The i-th line of the last K lines contains four positive integers x_{s}, y_{s}, x_{t}, y_{t} and d_{i}, indicating it
costs d_{i} to destroy the i-th tunnel from (x_{s},y_{s}) to (x_{t},y_{t}), where 1 ≤ x_{s},x_{t} ≤ n, 1 ≤ y_{s},y_{t} ≤ m
and 1 ≤ d_{i} ≤ 2 000.

For each test case, output a line containing an integer, indicating the minimal costs to present poison things moving from the source to the storage area. If there is no way to make it, output -1.

2 2 1

1 1 2 2

5 4

3 2

2 1

2 2

8