#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int n, m, a, b, nv, nm, sreca=0;
    cin>>n>>m;
    int d[n+1], s[n+1]={0};
    for(int i=1; i<=n; i++){
        cin>>d[i];
    }
    for(int i=1; i<=m; i++){
        cin>>a>>b;
        if(abs(d[a])<=abs(d[b])){
            nv=b;
            nm=a;
        }
        else{
            nv=a;
            nm=b;
        }
        if(d[nv]<0){
            s[nv]--;
            s[nm]--;
        }
        else{
            s[nv]++;
            s[nm]++;
        }
    }
    for(int i=1; i<=n; i++){
        sreca+=d[i]*s[i];
    }
    cout<<sreca<<"\n";
    return 0;
}