#include <stdio.h>
#include <stdlib.h>
unsigned long long int apsolutno(long int a)
{
    if(a<0)
        return -1*a;
    return a;
}
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    long int a[n];
    int i,x,y;
    unsigned long long int s=0;
    for(i=0;i<n;i++)
    {
        scanf("%li",&a[i]);
    }
    for(i=0;i<m;i++)
    {
        scanf("%d%d",&x,&y);
        s+=apsolutno(a[x-1]+a[y-1]);
    }
    printf("%llu",s);
}