#include<cstdio>
#include<algorithm>
#define MN 1000001
#define ll long long
using namespace std;
int read_p,read_ca;
inline int read(){
read_p=0;read_ca=getchar();
while(read_ca<‘0‘||read_ca>‘9‘) read_ca=getchar();
while(read_ca>=‘0‘&&read_ca<=‘9‘) read_p=read_p*10+read_ca-48,read_ca=getchar();
return read_p;
}
struct na{int x,y,p,o,ne;}b[MN<<1];
struct fy{int x,y,p,o;}F[MN];
bool operator < (fy a,fy b){return a.o==b.o?a.p<b.p:a.o>b.o;}
int n,m,k,g[MN],no[MN],ch[MN][2],a,_b,fa[MN],de[MN],num=0,l[MN],NUM=0,bo[MN];
ll MMH=0;
inline int min(int a,int b){return a<b?a:b;}
int gf(int x){return x==fa[x]?x:fa[x]=gf(fa[x]);}
inline void add(int x,int y){x=gf(x);y=gf(y);fa[x]=y;}
inline void in(int x,int y,int p){b[++num].y=y;b[num].p=p;b[num].ne=l[x];l[x]=num;}
void dfs(int x,int u){
if (x<=n){
bo[x]=u;
for (int i=l[x];i;i=b[i].ne)
if (bo[b[i].y]==u) F[++NUM]=fy{x,b[i].y,b[i].p,de[gf(b[i].y)]};
}else{
de[ch[x][0]]=de[x]+1;de[ch[x][1]]=de[x]+1;
dfs(ch[x][0],u);add(ch[x][0],x);dfs(ch[x][1],u);add(ch[x][1],x);
}
}
int main(){
n=read();m=read();k=read();
for (int i=1;i<=n;i++) g[i]=read(),no[i]=i;
for (int i=1;i<=m;i++) a=read(),_b=read(),ch[i+n][0]=no[a],ch[i+n][1]=no[_b],no[_b]=i+n;
for (int i=1;i<=m+n;i++) fa[i]=i;
for (int i=1;i<=k;i++) a=read(),_b=read(),in(a,_b,i),in(_b,a,i);
for (int i=m;i;i--)
if (!de[i+n]) dfs(i+n,i+n);
sort(F+1,F+1+NUM);
for (int i=1;i<=NUM;i++) a=min(g[F[i].x],g[F[i].y]),g[F[i].x]-=a,g[F[i].y]-=a,MMH+=a+a;
printf("%lld\n",MMH);
}