#include<bits/stdc++.h>
using namespace std;
int n,m;
long long a[100010];
int x,y;
long long sum;
int main()
{
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(int i=1;i<=m;i++)
    {
        scanf("%d %d",&x,&y);
        if((a[x]<=0 and a[y]<=0))
        {
            sum+=abs(a[x])+abs(a[y]);
            continue;
        }
        if(a[x]>=0 and a[y]>=0)
        {
            sum+=(a[x]+a[y]);
            continue;
        }
        if((a[x]>=0 and a[y]<=0) or (a[x]<=0 and a[y]>=0))
        {
            sum+=abs(a[x]+a[y]);
            continue;
        }
    }
    printf("%d\n",sum);
    return 0;
}