#!/usr/bin/env python3 import sys import threading import heapq INF = 10**30 N, M, K = map(int, input().split()) costs = list(map(int, input().split())) adj = [[] for _ in range(N + 1)] for i in range(M): u, v = map(int, input().split()) c = costs[i] adj[u].append((v, c)) adj[v].append((u, c)) dist = [[INF] * (K + 1) for _ in range(N + 1)] dist[1][0] = 0 pq = [(0, 1, 0)] while pq: cost_so_far, u, used = heapq.heappop(pq) if cost_so_far > dist[u][used]: continue for v, w in adj[u]: nc = cost_so_far + w if nc < dist[v][used]: dist[v][used] = nc heapq.heappush(pq, (nc, v, used)) if used < K: if cost_so_far < dist[v][used + 1]: dist[v][used + 1] = cost_so_far heapq.heappush(pq, (cost_so_far, v, used + 1)) ans = min(dist[N]) print(ans if ans < INF else -1)