R=range J=lambda:map(int,input().split()) N,M,Q=J() E=[[]for i in R(N)] F=[] for j in R(M):u,v,w=J();E[u-1]+=[j];F+=[[u-1,v-1,-w]] P=[9**20]*N P[0]=0 for _ in R(N): for i,j,w in F:P[j]=min(P[j],P[i]+w) import heapq B=[1]*M for j in J(): B[j-1]^=1;W,S=[0]+[9**30]*N,[[0,0]] while S: w,i=heapq.heappop(S) if w>W[i]:continue for e in E[i]: if B[e]: i,j,v=F[e];v+=P[i]-P[j] if w+v