n,m,k=map(int,input().split()) r=list(map(int,input().split())) for i in range(k): r[i]-=1 e=[[[] for j in range(n)] for i in range(1<>p)&1==0: e[j][a]+=[(j|(1<0: sc,sp,sy=heappop(q) if sc>v[sp][sy]: continue for tp,ty,tc in e[sp][sy]: if v[tp][ty]>sc+tc: v[tp][ty]=sc+tc heappush(q,(v[tp][ty],tp,ty)) print(v[-1][-1])