#include <iostream>

using namespace std;

long long int k,x,y,n,m;

int main()
{
    cin>>n>>m;
    int a[n];
    k=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int j=0;j<m;j++){
        cin>>x>>y;
        if(a[x-1]*a[y-1]>0){
            k=k+abs(a[x-1]+a[y-1]);
        }
        else{
            k=k+abs(abs(a[x-1])-abs(a[y-1]));
        }
    }
    cout<<k;
    return 0;
}