n,m,K=map(int,input().split()) a=list(map(int,input().split())) X=10**20 e=[[X]*n for i in range(n)] for i in range(n): e[i][i]=0 for i in range(m): x,y,z=map(int,input().split()) x-=1 y-=1 e[x][y]=z e[y][x]=z for k in range(n): for i in range(n): for j in range(n): e[i][j]=min(e[i][j],e[i][k]+e[k][j]) q=[X]*(1<>j)&1==0: q[i|(1<>k)&1==1)) print(min(q[i] for i in range(1<