#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N,M;
    cin>>N>>M;
    int A[N];
    long long ukupno = 0;
    for (int i=0;i<N;i++)cin>>A[i];
    for (int i=0;i<M;i++)
    {
        int X,Y;
        cin>>X>>Y;
        X--;Y--;
        ukupno += max(A[X]+A[Y],-A[X]-A[Y]);
        //cout<<A[X]+A[Y]<<" "<<-A[X]-A[Y]<<endl;
    }
    cout<<ukupno;
    return 0;
}