""" https://yukicoder.me/problems/no/2321 全く手が付かないと思ったら、意外性が凄かった """ import heapq def Dijkstra(lis,start): ret = [float("inf")] * len(lis) ret[start] = 0 end_flag = [False] * len(lis) end_num = 0 q = [(0,start)] while len(q) > 0: ncost,now = heapq.heappop(q) if end_flag[now]: continue end_flag[now] = True end_num += 1 if end_num == len(lis): break for nex,ecost in lis[now]: if ret[nex] > ncost + ecost: ret[nex] = ncost + ecost heapq.heappush(q , (ret[nex] , nex)) return ret N,M,C = map(int,input().split()) A = list(map(int,input().split())) lis = [ [] for i in range(N+1) ] for i in range(N): lis[i].append( (i+1,A[i]) ) lis[i+1].append( (i,A[i]) ) for i in range(M): L,R = map(int,input().split()) L -= 1 lis[L].append( (R,C) ) lis[R].append( (L,C) ) ans = sum(A) - Dijkstra(lis,0)[-1] print (ans)