#include using namespace std; #define ll long long const int MAXN=2e5+5; ll a[MAXN],n,m,c; struct edge{ ll v,w; }; vector G[MAXN]; ll dis[MAXN],vis[MAXN]; struct node{ ll dis,u; bool operator>(const node& a) const { return dis>a.dis; } }; inline ll read(){ ll x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<1)+(x<<3)+(ch^48);ch=getchar(); } return x*f; } priority_queue,greater >q; void dijkstra(int s){ for(int i=0;i<=n+1;++i){ dis[i]=0x3f3f3f3f3f3f3f3f; vis[i]=0; } dis[s]=0; q.push({0,s}); while (!q.empty()){ ll u=q.top().u; q.pop(); if (!vis[u]){ vis[u]=1; for(auto Q:G[u]){ ll v=Q.v,w=Q.w; if (dis[v]>dis[u]+w){ dis[v]=dis[u]+w; q.push({dis[v],v}); } } } } } int main(){ ll T=1; while (T--){ ll sum=0; n=read(),m=read(),c=read(); for(int i=1;i<=n;++i){ a[i]=read(); G[i].push_back({i+1,a[i]}); G[i+1].push_back({i,a[i]}); sum+=a[i]; } for(int i=1;i<=m;++i){ ll l=read(),r=read(); G[l].push_back({r+1,c}); G[r+1].push_back({l,c}); } dijkstra(1); // cout<