from heapq import heappush, heappop N, M, K = map(int, input().split()) C = list(map(int, input().split())) G = [[] for _ in range(N)] for i in range(M): u, v = map(int, input().split()) G[u-1].append((v-1, C[i])) G[v-1].append((u-1, C[i])) INF = 10**18 def dijkstra(start): dist = [[INF]*(K+1) for _ in range(N)] dist[start][0] = 0 visited = [[False]*(K+1) for _ in range(N)] que = [(0, start, 0)] while que: d, now, c = heappop(que) if visited[now][c]: continue visited[now][c] = True for next, weight in G[now]: if dist[now][c]+weight < dist[next][c]: dist[next][c] = dist[now][c]+weight heappush(que, (dist[next][c], next, c)) if c < K and dist[now][c] < dist[next][c+1]: dist[next][c+1] = dist[now][c] heappush(que, (dist[next][c+1], next, c+1)) return dist dist = dijkstra(0) ans = min(dist[-1]) print(ans if ans != INF else -1)