#include <bits/stdc++.h>
using i64 = long long;
#ifdef DEBUG
#include "debug.h"
#else
#define debug(...) void(23)
#endif
constexpr int max_N = int(2E5) + 5;
constexpr int max_M = int(4E5) + 5;
int N;
int M;
int Q;
i64 S[max_N];
std::array<i64, 3> E[max_M];
std::vector<int> adj[max_N];
struct DSU {
std::vector<int> f, siz;
DSU(int n) : f(n), siz(n, 1) {
std::iota(f.begin(), f.end(), 0);
}
int get(int x) {
while (x != f[x]) {
x = f[x] = f[f[x]];
}
return x;
}
bool unite(int a, int b) {
a = get(a), b = get(b);
if (a == b) {
return false;
} else if (siz[a] > siz[b]) {
std::swap(a, b);
}
f[a] = b;
siz[b] += siz[a];
return true;
}
bool same(int a, int b) {
return get(a) == get(b);
}
int size(int x) {
return siz[get(x)];
}
};
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cin >> N >> M >> Q;
for (int i = 0; i < N; ++i) {
std::cin >> S[i];
}
for (int i = 0; i < M; ++i) {
std::cin >> E[i][1] >> E[i][2];
--E[i][1], --E[i][2];
E[i][0] = S[E[i][1]] + S[E[i][2]];
}
std::sort(E, E + M);
i64 ans = *std::max_element(S, S + N) - std::accumulate(S, S + N, 0LL);
DSU dsu(N);
for (int i = 0; i < M; ++i) {
if (dsu.unite(E[i][1], E[i][2])) {
ans += E[i][0];
}
}
std::cout << ans << '\n';
return 0;
}