N,M,K=map(int,input().split()) A=list(map(int,input().split())) for i in range(K+1): A[i]-=1 dist=[[10**15]*N for i in range(N)] for i in range(N): dist[i][i]=0 for i in range(M): a,b,c=map(int,input().split()) dist[a-1][b-1]=c dist[b-1][a-1]=c for k in range(N): for i in range(N): for j in range(N): dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]) Q=int(input()) for i in range(Q): t,x,y=map(int,input().split()) if t==1: A[x]=y-1 else: result=0 for j in range(x,y): pos=A[j] pos2=A[j+1] result+=dist[pos][pos2] print(result)