#include<bits/stdc++.h>
#define MAXN 510
#define inf (1<<29)
using namespace std;

typedef pair<int, int> PII;

int mini(int a, int b){return (a<b)?a:b;}
int maxi(int a, int b){return (a>b)?a:b;}

int n,m,K;
PII ps[10];
int V[MAXN][MAXN], R[MAXN][MAXN], C[MAXN][MAXN];

struct node{
	int x,y,cost;
	node(){}
	node(int _x, int _y, int _cost){
		x = _x;
		y = _y;
		cost = _cost;
	}
};

bool operator <(const node &a, const node &b){
	return a.cost > b.cost;
}


struct BIT : priority_queue<node> {
	int u[MAXN][MAXN], r, c;
	void init(int n, int m){
		this->r = n;
		this->c = m;
		memset(u, 0, sizeof(u));
		for(int i = 1; i <= n; i++)
			for(int j = 1; j <= m; j++)
				update(i, j, 1);
		while(!empty()) pop();
	}
	void update(int x, int y, int cost){
		for(int i = x; i <= r; i += i & -i)
			for(int j = y; j <= c; j += j & -j)
				u[i][j] += cost;
	}
	int get(int x, int y){
		int tmp = 0;
		for(int i = x; i; i -= i & -i)
			for(int j = y; j; j -= j & -j)
				tmp += u[i][j];
		return tmp;
	}
	int get(int x_1, int y_1, int x_2, int y_2){
		return get(x_2, y_2) - get(x_2, y_1 - 1) - get(x_1 - 1, y_2) + get(x_1 - 1, y_1 - 1);
	}
	void cover(int x_1, int y_1, int x_2, int y_2, int cost, int tot){
		if (!tot)
			return ;
		int mx = x_1 + x_2 >> 1;
		int my = y_1 + y_2 >> 1;
		if (x_1 == x_2){
			if (y_1 == y_2){
				push(node(x_1, y_1, cost + V[x_1][y_1]));
				update(x_1, y_1, -1);
				return ;
			}
			int cnt = get(x_1, y_1, x_2, my);
			if (cnt)
				cover(x_1, y_1, x_2, my, cost, cnt);
			if (tot - cnt)
				cover(x_1, my + 1, x_2, y_2, cost, tot - cnt);
		}
		else{
			int cnt = get(x_1, y_1, mx, y_2);
			if (cnt)
				cover(x_1, y_1, mx, y_2, cost, cnt);
			if (tot - cnt)
				cover(mx + 1, y_1, x_2, y_2, cost, tot - cnt);
		}
		return ;
	}
} BT;

int dij(int sx, int sy, int dx, int dy){
    if (sx == dx && sy == dy) return 0;
    BT.init(n, m);
	BT.update(sx, sy, -1);
    BT.push(node(sx, sy, V[sx][sy]));
	while(!BT.empty()){
		node u = BT.top();
		BT.pop();
		int r = R[u.x][u.y];
		int c = C[u.x][u.y];
		if (abs(u.x - dx) <= r && abs(u.y - dy) <= c)
			return u.cost;
		BT.cover(maxi(1, u.x - r), maxi(1, u.y - c), mini(n, u.x + r), mini(m, u.y + c), u.cost, BT.get(maxi(1, u.x - r), maxi(1, u.y - c), mini(n, u.x + r), mini(m, u.y + c)));
	}
	return -1;
}

int read(){    
    int x=0;char ch=getchar();
    while((ch>'9' || ch<'0')) ch=getchar();
    while(ch>='0' && ch<='9')   x=x*10+ch-'0',ch=getchar();
    return x;
}

int main(){
	int i,j,k,l,test,t = 1;
	while(scanf("%d%d%d",&n,&m,&K) == 3){
		for(i = 1; i <= n; i++)
			for(j = 1; j <= m; j++)
				V[i][j] = read();
		for(i = 1; i <= n; i++)
			for(j = 1; j <= m; j++)
				R[i][j] = read();
		for(i = 1; i <= n; i++)
			for(j = 1; j <= m; j++)
				C[i][j] = read();
		for(i = 1; i <= K; i++){
			k = read();
			l = read();
			ps[i] = make_pair(k, l);
			if (i > 1){
				int Nico = V[ps[i].first][ps[i].second];
				V[ps[i].first][ps[i].second] = 0;
				int ans = dij(ps[i-1].first, ps[i-1].second, ps[i].first, ps[i].second);
				V[ps[i].first][ps[i].second] = Nico;
				if (ans >= inf)
					ans = -1;
				if (i>2)
					printf(" ");
				printf("%d",ans);
			}
		}
		puts("");
	}
	return 0;
}
