#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
const int N = 2510;
int n, m, k;
long long sc[N];
int ver[20010], nxt[20010], head[20010], tot;
void add(int x, int y){
ver[++tot] = y;
nxt[tot] = head[x];
head[x] = tot;
}
bool vis[N];
int dis[N][N];
vector<int> v[N];
bool cmp(int xx, int yy){
return sc[xx] > sc[yy];
}
void bfs(int root){
memset(vis, 0, sizeof(vis));
queue<int> q;
vis[root] = 1;
dis[root][root] = 0;
q.push(root);
while(!q.empty()){
int x = q.front();
q.pop();
for(int i = head[x]; i; i = nxt[i]){
int y = ver[i];
if(vis[y])
continue;
dis[root][y] = dis[root][x] + 1;
if(y != 1 && root != 1 && dis[root][y] <= k + 1 && dis[1][y] <= k + 1){
if(v[root].size() < 3)
v[root].push_back(y);
else{
sort(v[root].begin(), v[root].end(), cmp);
if(sc[y] > sc[v[root][2]])
v[root][2] = y;
}
}
vis[y] = 1;
q.push(y);
}
}
}
long long ans;
bool same(int a, int b, int c, int d){
if(a == b || a == c || a == d || b == c || b == d || c == d)
return 1;
return 0;
}
long long count(int a, int b, int c, int d){
if(same(a, b, c, d))
return 0;
return sc[a] + sc[b] + sc[c] + sc[d];
}
int main(){
scanf("%d%d%d", &n, &m, &k);
for(int i = 2; i <= n; i++)
scanf("%d", &sc[i]);
for(int i = 1; i <= m; i++){
int x, y;
scanf("%d%d", &x, &y);
add(x, y);
add(y, x);
}
memset(dis, 0x3f, sizeof(dis));
for(int i = 1; i <= n; i++)
bfs(i);
for(int b = 2; b <= n; b++)
for(int c = 2; c <= n; c++){
if(dis[b][c] > k + 1)
continue;
for(int i = 0; i < v[b].size(); i++)
for(int j = 0; j < v[c].size(); j++){
int a = v[b][i], d = v[c][j];
ans = max(ans, count(a, b, c, d));
}
}
cout << ans << endl;
return 0;
}