#include #define fi first #define se second #define eb emplace_back #define mp make_pair using namespace std; typedef long double ld; typedef long long ll; typedef unsigned long long ull; typedef __int128 i128; template T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);} template T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);} template bool chmax(T &a,const S b) {return (a bool chmin(T &a,const S b) {return (a>b?a=b,1:0);} int popcnt(int x) {return __builtin_popcount(x);} int popcnt(ll x) {return __builtin_popcountll(x);} int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));} int topbit(ll x) {return (x==0?-1:63-__builtin_clzll(x));} int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));} int lowbit(ll x) {return (x==0?-1:__builtin_ctzll(x));} #define rep(i,a,b) for(int i=(a);i<=(b);i++) #define per(i,a,b) for(int i=(a);i>=(b);i--) #define ac 1 #define wa 0 typedef pair pii; typedef vector vi; typedef vector vp; int read() { int x=0,w=1; char c=getchar(); while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();} while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();} return x*w; } #define int long long const int N=2e5+9,inf=2e18; int n,m,d[N],ans,c; vp e[N]; void dijkstra() { d[1]=0; rep(i,2,n+1) d[i]=inf; priority_queueq; q.push(pii(0,1)); while(!q.empty()) { int u=q.top().se; q.pop(); for(auto [v,w]:e[u]) if(d[v]>d[u]+w) d[v]=d[u]+w, q.push(pii(-d[v],v)); } } signed main() { n=read(), m=read(), c=read(); rep(i,1,n) { int a=read(); ans+=a; e[i].eb(i+1,a), e[i+1].eb(i,a); } rep(i,1,m) { int l=read(), r=read(); e[l].eb(r+1,c), e[r+1].eb(l,c); } dijkstra(); printf("%lld\n",ans-d[n+1]); return 0; }