#include<algorithm>
#include<iostream>
#include<string.h>
#include<cstdio>
#include<vector>
#include<cmath>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define int long long
#define repu(i,u) for(int i=(h[u]);i;i=(ne[i]))
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pii pair<int,int>
#define inf 0x3f3f3f3f
#define xx return
const int N=2e6+10;
int n,m,Q;
int k[N],Max[N];
int h[N],e[N*2],ne[N*2],edge[N*2],idx;
namespace xx_Dij{
priority_queue<pii>q;
int dis[N];
int vis[N];
void dij(int s){
memset(dis,inf,sizeof dis);
memset(vis,0,sizeof vis);
dis[s]=k[s];
q.push(make_pair(-dis[s],s));
while(q.size()){
int u=q.top().second;
q.pop();
if(vis[u])continue;
vis[u]=1;
repu(i,u){
int v=e[i],w=edge[i];
if(dis[v]>dis[u]+w){
dis[v]=dis[u]+w;
q.push(make_pair(-dis[v],v));
}
}
}
}
}
namespace Main_xx{
#define p(x,y) ((x-1)*m+y)
void add_edge(int a,int b,int c){e[++idx]=b,ne[idx]=h[a],edge[idx]=c,h[a]=idx;}
void Main(){
cin>>n>>m>>Q;
vector<int>G;
rep(i,1,n)rep(j,1,m)cin>>k[p(i,j)];
rep(i,1,Q){
int x,y;cin>>x>>y;
G.push_back(p(x,y));
}
rep(i,1,n)rep(j,1,m){
if(i!=1&&k[p(i,j)]+k[p(i-1,j)]<0){cout<<"No";xx;}
if(j!=1&&k[p(i,j)]+k[p(i,j-1)]<0){cout<<"No";xx;}
if(i!=1)add_edge(p(i,j),p(i-1,j),k[p(i-1,j)]);
if(j!=1)add_edge(p(i,j),p(i,j-1),k[p(i,j-1)]);
if(i!=n)add_edge(p(i,j),p(i+1,j),k[p(i+1,j)]);
if(j!=m)add_edge(p(i,j),p(i,j+1),k[p(i,j+1)]);
}
memset(Max,-inf,sizeof Max);
rep(i,0,G.size()-1){
xx_Dij::dij(G[i]);
rep(j,1,n*m)Max[j]=max(Max[j],xx_Dij::dis[j]);
}
int Min=inf;
rep(i,1,n*m)Min=min(Min,Max[i]);
cout<<Min<<endl;
xx;
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
Main_xx::Main();
xx 0;
}
3pts求调