#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int sj1=200005;
const int sj2=500005;
const int sj3=sj1+sj2;
int n,m,k,f[sj3],g[sj1],yz[sj2],yy[sj2],h[sj1],zx[sj3];
int tp,d[sj3],e1,e2,lca[sj2],fa[sj2],size,w[sj3];
long long ans;
bool r[sj3];
int read()
{
int jg=0,jk=getchar()-‘0‘;
if(jk<=9&&jk>0) jg=jk;
jk=getchar()-‘0‘;
while(jk<=9&&jk>=0)
jg=jg*10+jk,jk=getchar()-‘0‘;
return jg;
}
int find(int x)
{
if(f[x]==-1) return x;
f[x]=find(f[x]);
return f[x];
}
void hb(int x,int y)
{
x=find(x),y=find(y);
if(x!=y) f[x]=y;
}
int fi(int x)
{
if(w[x]==-1) return x;
w[x]=fi(w[x]);
return w[x];
}
void hbb(int x,int y)
{
x=fi(x),y=fi(y);
if(x!=y) w[x]=y;
}
struct tree
{
int v,ne,num;
}t[sj2<<1];
struct B
{
int v,ne;
}b[sj2<<2];
void ad1(int x,int y,int z)
{
t[e1].v=y,t[e1].ne=h[x];
t[e1].num=z,h[x]=e1++;
}
void ad2(int x,int y)
{
b[e2].v=y,b[e2].ne=d[x];
d[x]=e2++;
}
void init()
{
memset(d,-1,sizeof(d));
memset(h,-1,sizeof(h));
memset(f,-1,sizeof(f));
memset(w,-1,sizeof(w));
n=read(),m=read(),k=read();
size=n;
for(int i=1;i<=n;i++) g[i]=read();
for(int i=1;i<=m;i++)
{
tp=read(),e1=read();
size++;
ad2(find(tp),size),ad2(find(e1),size);
ad2(size,find(tp)),ad2(size,find(e1));
hb(tp,size),hb(e1,size);
}
for(int i=1;i<=k;i++) yz[i]=read(),yy[i]=read();
e1=0;
for(int i=k;i>=1;i--)
ad1(yz[i],yy[i],i),ad1(yy[i],yz[i],i);
}
void tarjan(int x)
{
r[x]=1,zx[x]=x;
for(int i=d[x];i!=-1;i=b[i].ne)
{
if(!r[b[i].v])
{
tarjan(b[i].v);
hb(x,b[i].v);
zx[find(b[i].v)]=x;
}
hbb(x,b[i].v);
}
if(x<=n)
for(int i=h[x];i!=-1;i=t[i].ne)
if(r[t[i].v]&&fi(x)==fi(t[i].v))
fa[t[i].num]=zx[find(t[i].v)];
}
int main()
{
init();
memset(f,-1,sizeof(f));
for(int i=n+m;i>=1;i--)
if(!r[i]) tarjan(i);
memset(b,0,sizeof(b));
memset(d,-1,sizeof(d));
for(int i=k;i>=1;i--)
if(fa[i])
ad2(fa[i],i);
for(int i=n+1;i<=n+m;i++)
for(int j=d[i];j!=-1;j=b[j].ne)
{
tp=b[j].v;
if(g[yy[tp]]==0||g[yz[tp]]==0) continue;
if(g[yy[tp]]<=g[yz[tp]])
{
ans+=g[yy[tp]];
g[yz[tp]]-=g[yy[tp]],g[yy[tp]]=0;
}
else
{
ans+=g[yz[tp]];
g[yy[tp]]-=g[yz[tp]],g[yz[tp]]=0;
}
}
printf("%lld",ans<<1);
return 0;
}