#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m, c, v, u, L, R; ll d, w; cin >> n >> m >> c; vector>> g(n + 1); vector a(n); vector as(n + 1), dist(n + 1, 1ll << 60); for(int i = 0; i < n; i++){ cin >> a[i]; as[i + 1] = as[i] + a[i]; g[i].emplace_back(i + 1, a[i]); g[i + 1].emplace_back(i, a[i]); } for(int i = 0; i < m; i++){ cin >> L >> R; L--; g[L].emplace_back(R, c); g[R].emplace_back(L, c); } priority_queue, vector>, greater>> pq; dist[0] = 0; pq.emplace(0, 0); while(!pq.empty()){ tie(d, v) = pq.top(); pq.pop(); if(d > dist[v]) continue; for(auto &&pa : g[v]){ tie(u, w) = pa; if(d + w >= dist[u]) continue; dist[u] = d + w; pq.emplace(dist[u], u); } } cout << as[n] - dist[n] << '\n'; }