#include <iostream>
#include <utility>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
    long N, M, x, y, O=0L, q;

    cin>>N>>M;

    vector<long> A(N);
    vector<pair<long, long> > B;

    for(int i=0; i<N; i++)
        cin>>A[i];

    for(int i=0; i<M; i++)
    {
        cin>>x>>y;
        B.push_back({x-1, y-1});
    }


    for(int i=0; i<M; i++)
    {
        q=abs(A[B[i].first])>abs(A[B[i].second])?A[B[i].first]/abs(A[B[i].first]):A[B[i].second]/abs(A[B[i].second]);
        O+=q*(A[B[i].first]+A[B[i].second]);
    }

    cout<<O;

    return 0;
}