There are multiple test cases end with EOF(no more than 10 test cases).

The first line: two integers n,m indicating the size of ZCC's city's traffic network(2<=n,m<=20)

Next n lines each line contain m numbers, the i+1-th line's j-th number w1[i][j] indicating the first red light's end time of the point (i,j)

Next n lines each line contain m numbers, the n+i+1-th line's j-th number w2[i][j] indicating the green light's end time of the point (i,j) (1<=w1[i][j]<=w2[i][j]<=2000000)(If w1[i][j] equals to w2[i][j], it means that the light is always red. Otherwise, in [ w1[i][j]+1, w2[i][j] ] the green light is on)

(Because the corners don't have lights, you can ignore the value in the corners)

Next n lines each line contain m-1 numbers, the 2*n+i+1-th line's j-th number l1[i][j] indicating the length between point(i,j) and point(i,j+1)

Next n-1 lines each line contain m numbers, the 3*n+i+1-th line's j-th number l2[i][j] indicating the length between point(i,j) and point(i+1,j) (1<=l1[i][j],l2[i][j]<=100000)

Next line contain 4 numbers sx,sy,tx,ty indicating the school's coordinate is (sx,sy) and home's coordinate is (tx,ty).