#icpc2013summerwarmingUpc. [icpc2013summer_warmingUp_c]Containers

[icpc2013summer_warmingUp_c]Containers

Description

Some 1times1times11 \\times 1 \\times 1 containers are piled up in land of WtimesHW \\times H.
The land is separated into 1times11 \\times 1 cells. Each of the containers is on one of the cells.

Figure 1

Figure 2: from The Sky

Figure 3: from The Front

Figure 4: from The Side

Given the photograph from the sky, front, and side respectively, calculate how many containers are piled up in the minimum.


Input

HH WW u11u_{11} u12u_{12} u1Wu_{1W} u21u_{21} :: :: uH1u_{H1} uH2u_{H2} uHWu_{HW} f1f_1 f2f_2 fWf_W s1s_1 s2s_2 sHs_H The first line of the input file contains the integers HH and WW (1leqH,Wleq1001 \\leq H,W \\leq 100), the number of height and width of the land.
Each of the following HH lines gives the photograph from the sky.
The value of uiju_{ij} means,
0: no containers are piled up in (i,j)(i, j),
1: some containers are piled up in (i,j)(i, j).
The next line gives the photograph from the front.
The integer fif_i is the number of the containers seen in ii-th row.(0leqfileq1000 \\leq f_i \\leq 100)
The next line gives the photograph from the side.
The integer sis_i is the number of the containers seen in ii-th column.(0leqsileq1000 \\leq s_i \\leq 100)

Output

Output the minimum number of the containers.
If the photographs are inconsistent, just output -1, instead.


Sample Input


2 3
0 1 0
1 1 1
2 3 2
2 3

Sample Output


9

Sample Input


4 6
1 1 0 1 0 0
0 0 1 0 0 1
0 1 0 0 0 1
0 0 1 0 1 0
1 2 1 2 1 1
2 1 2 1

Sample Output


11

Source Name

The First KMCMonthly Contest