#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<int>ve[2510];
int u,v,g[2510][2510],w[2510],gh[2510][2510],n,m,k,cnt=0,num=1,tempa,tempd,ans=0,ansa,ansb,ansc,ansd;
struct node{
int val;
int id;
}a[2510];
void bfs(int x){
queue<int>q;
while(!q.empty())q.pop();
q.push(x);
g[x][x]=0;
while(!q.empty()){
int u=q.front();
q.pop();
for(auto v:ve[u]){
if(g[x][v]>g[x][u]+1){
g[x][v]=g[x][u]+1;
q.push(v);
}
}
}
}
bool cmp(const node &x,const node &y){
return x.val>y.val;
}
signed main(){
cin>>n>>m>>k;
for(int i=2;i<=n;i++){
scanf("%d",&w[i]);
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
g[i][j]=0x3f;
}
}
for(int i=1;i<=m;i++){
scanf("%d %d",&u,&v);
ve[u].push_back(v);
ve[v].push_back(u);
}
for(int i=1;i<=n;i++){
bfs(i);
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(g[i][j]<=k+1){
gh[i][j]=1;
}
}
}
for(int i=2;i<=n;i++){
if(gh[1][i]){
cnt++;
a[cnt].id=i;
a[cnt].val=w[i];
}
}
sort(a+1,a+cnt+1,cmp);
for(int b=2;b<=n;b++){
for(int c=2;c<=n;c++){
if(b!=c && gh[b][c]){
num=1;
while(num<cnt){
if(a[num].id!=b && a[num].id!=c && gh[a[num].id][b]){
tempa=num;
break;
}
num++;
}
if(num==cnt)continue;
--num;
while(num<=cnt){
if(a[num].id!=a[tempa].id && a[num].id!=b && a[num].id!=c && gh[c][a[num].id]){
tempd=a[num].id;
break;
}
num++;
}
if(num>cnt)continue;
if(a[tempa].val+w[b]+w[c]+a[num].val>ans){
ans=a[tempa].val+w[b]+w[c]+a[num].val;
}
}
}
}
cout<<ans;
return 0;
}