// MADE BY QT666
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
const int N=2000050;
int fa[N],g[N],dfn[N],n,m,k,tt,tot;
int head[N],to[N],nxt[N],cnt;
int size[N],son[N],deep[N],tmp,top[N],father[N];
void lnk(int x,int y){
to[++cnt]=y,nxt[cnt]=head[x],head[x]=cnt;
to[++cnt]=x,nxt[cnt]=head[y],head[y]=cnt;
}
void dfs1(int x,int f){
size[x]=1;deep[x]=deep[f]+1;
for(int i=head[x];i;i=nxt[i]){
int y=to[i];if(y==f) continue;
dfs1(y,x);father[y]=x;size[x]+=size[y];
if(size[y]>size[son[x]]) son[x]=y;
}
}
void dfs2(int x,int f){
top[x]=f;dfn[x]=++tmp;
if(son[x]) dfs2(son[x],f);
for(int i=head[x];i;i=nxt[i]){
int y=to[i];
if(y==father[x]||y==son[x]) continue;
dfs2(y,y);
}
}
int Lca(int x,int y){
while(top[x]!=top[y]){
if(deep[top[x]]<deep[top[y]]) swap(x,y);
x=father[top[x]];
}
if(deep[x]<deep[y]) swap(x,y);
return y;
}
struct data{
int x,y,Lca,id;
}q[N];
bool cmp(const data &a,const data &b){
if(deep[a.Lca]==deep[b.Lca]) return a.id<b.id;
return deep[a.Lca]>deep[b.Lca];
}
int find(int x){
if(x!=fa[x]) fa[x]=find(fa[x]);
return fa[x];
}
int main(){
scanf("%d%d%d",&n,&m,&k);tt=n;
for(int i=1;i<=n;i++) scanf("%d",&g[i]);
for(int i=1;i<=n;i++) fa[i]=i;
for(int i=1;i<=m;i++){
int x,y;scanf("%d%d",&x,&y);
tt++;x=find(x),y=find(y);
lnk(tt,x);lnk(tt,y);fa[x]=fa[y]=tt;fa[tt]=tt;
}
for(int i=1;i<=tt;i++) if(find(i)==i) dfs1(i,0),dfs2(i,i);
for(int i=1;i<=k;i++){
int x,y;scanf("%d%d",&x,&y);
if(find(x)==find(y)) q[++tot]=(data){x,y,Lca(x,y),i};
}
sort(q+1,q+1+tot,cmp);ll ans=0;
for(int i=1;i<=tot;i++){
int res=min(g[q[i].x],g[q[i].y]);
g[q[i].x]-=res,g[q[i].y]-=res,ans+=1ll*(res<<1);
}
printf("%lld\n",ans);
return 0;
}