#include<cstdio>
char buf[16000000],*ptr=buf-1;
const int N=200007;
int _(){
int x=0,c=*++ptr;
while(c<48)c=*++ptr;
while(c>47)x=x*10+c-48,c=*++ptr;
return x;
}
int n,m,k,g[N];
int ch[N*2][2],fa[N*2],son[N*2],sz[N*2],dep[N*2],top[N*2],f[N*2],idp,v[500007][2];
int es[500007],enx[500007],e0[500007],ep=2;
long long ans=0;
bool ed[N*2];
void f1(int w,int pa){
dep[w]=dep[fa[w]=pa]+1;
sz[w]=1;
if(w>n)
for(int i=0;i<2;++i){
int u=ch[w][i];
f1(u,w);
sz[w]+=sz[u];
if(sz[u]>sz[son[w]])son[w]=u;
}
}
void f2(int w,int tp){
top[w]=tp;
if(son[w])f2(son[w],tp);
if(w>n)
for(int i=0;i<2;++i){
int u=ch[w][i];
if(u!=son[w])f2(u,u);
}
}
int min(int a,int b){return a<b?a:b;}
void dec(int w){
int x=v[w][0],y=v[w][1],z=min(g[x],g[y]);
g[x]-=z,g[y]-=z,ans+=z;
}
void f3(int w){
if(w>n)
for(int i=0;i<2;++i)f3(ch[w][i]);
for(int i=e0[w];i;i=enx[i])dec(es[i]);
}
int lca(int x,int y){
int a=top[x],b=top[y];
while(a!=b){
if(dep[a]>dep[b])x=fa[a],a=top[x];
else y=fa[b],b=top[y];
}
return dep[x]<dep[y]?x:y;
}
int get(int x){
int a=x,c;
while(x!=f[x])x=f[x];
while(x!=f[a])c=f[a],f[a]=x,a=c;
return x;
}
int main(){
fread(buf,1,sizeof(buf),stdin);
idp=n=_();m=_();k=_();
for(int i=1;i<=n;++i)g[i]=_(),f[i]=i;
for(int i=1,a,b;i<=m;++i){
a=_(),b=_();
++idp;
a=get(a),b=get(b);
ch[idp][0]=a;
ch[idp][1]=b;
ed[a]=ed[b]=1;
f[a]=f[b]=f[idp]=idp;
}
for(int i=1;i<=idp;++i)if(!ed[i])f1(i,0),f2(i,i);
for(int i=1;i<=k;++i)v[i][0]=_(),v[i][1]=_();
for(int i=k;i;--i){
int c=lca(v[i][0],v[i][1]);
if(c)es[ep]=i,enx[ep]=e0[c],e0[c]=ep++;
}
for(int i=1;i<=idp;++i)if(!ed[i])f3(i);
printf("%lld\n",ans<<1);
return 0;
}