#include<bits/stdc++.h>
#define MAXM 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[MAXM][MAXM], R[MAXM][MAXM], C[MAXM][MAXM];
int vis[MAXM][MAXM], kas = 1;
int d[MAXM][MAXM];

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;
}

int dij(int sx, int sy, int dx, int dy){
	priority_queue<node> pq;
	kas++;
	node now = node(sx,sy,0 + V[sx][sy]);
	int i,j;
	d[sx][sy] = 0;
	pq.push(now);
	while(!pq.empty()){
		node tmp = pq.top();
		pq.pop();
		int x = tmp.x, y = tmp.y;
		if (x == dx && y == dy)
			return d[x][y];
		for(i = maxi(1,x - R[x][y]); i <= mini(n, x + R[x][y]); i++){
			for(j = maxi(1, y - C[x][y]); j <= mini(m, y + C[x][y]); j++){
				if (vis[i][j] != kas || d[i][j] > tmp.cost){
					vis[i][j] = kas;
					d[i][j] = tmp.cost;
					node now = node(i, j, tmp.cost + V[i][j]);
					pq.push(now);
				} 
			}
		}
	}
	return -1;
}

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++)
				scanf("%d", &V[i][j]);
		for(i = 1; i <= n; i++)
			for(j = 1; j <= m; j++)
				scanf("%d", &R[i][j]);
		for(i = 1; i <= n; i++)
			for(j = 1; j <= m; j++)
				scanf("%d", &C[i][j]);
		for(i = 1; i <= K; i++){
			scanf("%d%d", &k, &l);
			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;
}
