#include <bits/stdc++.h>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define endl '\n'
using namespace std;
typedef long long LL;
typedef pair<LL,int > PII;
const int N = 2505;
const int M = 1e4+5;
LL w[N];
int pre[N];
struct node{
int to,next;
}e[M*2];
int n,m,tot,k;
int dis[N][N];
bool f[N];
int q[N],h,t;
set<PII > st[N];
inline void add(int u,int v){
e[++tot] = {v,pre[u]};
pre[u] = tot;
}
inline void bfs(int x){
memset(f,0,sizeof(f));
f[x] = h = t = 1;
q[1] = x,dis[x][x] = 0;
while(h <= t){
int p = q[h];
for(int i = pre[p]; i; i = e[i].next){
if(!f[e[i].to]){
dis[x][e[i].to] = dis[x][p] + 1;
if(dis[x][e[i].to] <= k)
q[++t] = e[i].to;
f[e[i].to] = true;
}
}
h++;
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(NULL);
int x,y;
cin >> n >> m >> k;
for(int i = 2; i <= n; i++)
cin >> w[i];
for(int i = 1; i <= m; i++){
cin >> x >> y;
add(x,y),add(y,x);
}
memset(dis,0x3f,sizeof(dis));
for(int i = 1; i <= n; i++){
bfs(i);
}
for(int i = 2; i <= n; i++){
for(int j = 2; j <= n; j++){
if(i != j && dis[i][j] < k && dis[1][j] < k){
st[i].insert({w[j],j});
if(st[i].size() > 3)
st[i].erase(st[i].begin());
}
}
}
LL ans = 0;
for(int b = 2; b <= n; b++){
for(int c = 2; c <= n; c++){
if(b != c && dis[b][c] < k){
for(auto a : st[b]){
if(a.second == c)
continue;
for(auto d : st[c]){
if(d.second == a.second || d.second == b)
continue;
ans = max(ans,w[b]+w[c]+w[a.second]+w[d.second]);
}
}
}
}
}
cout << ans << endl;
return 0;
}