import sys import heapq input = sys.stdin.readline def read_values(): return map(int, input().split()) def read_index(): return map(lambda x: int(x) - 1, input().split()) def read_list(): return list(read_values()) class Dijkstra: def __init__(self,n): self.dist=[int(1e18)]*n self.g = [list() for _ in range(n)] def add(self,u,v,c): self.g[u].append((v,c)) def calc(self,s): self.dist[s]=0 q = [(0,s)] while(len(q)>0): d,v0 = heapq.heappop(q) if(d>self.dist[v0]):continue for (v1,c) in self.g[v0]: if(self.dist[v1]<=d+c):continue self.dist[v1]=d+c heapq.heappush(q,(self.dist[v1],v1)) def main(): n,m,c=read_values() a=read_list() l=[0]*m r=[0]*m for i in range(m): l[i],r[i]=read_values() dj=Dijkstra(n+1) for i in range(n): dj.add(i+0,i+1,a[i]) dj.add(i+1,i+0,a[i]) for i in range(m): dj.add(l[i]-1,r[i],c) dj.add(r[i],l[i]-1,c) dj.calc(0) print(sum(a)-dj.dist[-1]) if __name__ == "__main__": main()