#include<iostream>

int main(){
    unsigned n,m;
    scanf("%u%u",&n,&m);
    long int a[n];
    for(unsigned i=0;i<n;i++)
        scanf("%ld",&a[i]);
    long long int s=0;
    {
    unsigned p,q;
    for(unsigned i=0;i<m;i++){
        scanf("%u%u",&p,&q);
        if(a[p-1]+a[q-1]>0)s+=(a[p-1]+a[q-1]);
        else s-=(a[p-1]+a[q-1]);
    }
    }
    printf("%lld",s);
}