from collections import deque H,W,N=map(int,input().split()) WARP={} for _ in range(N): a,b,c,d=map(int,input().split()) a-=1;b-=1;c-=1;d-=1 WARP[(a,b)]=(c,d) G=[[10**10 for _ in range(W)] for _ in range(H)] Q=deque([]) Q.append(((0,0),0)) while Q: (h,w),c=Q.popleft() c=min(c,G[h][w]) G[h][w]=c if h+1