#include <iostream>

using namespace std;

int main()
{
    int n,m,x,y;
    cin>>n>>m;

    long long a[n],u = 0;

    for(int i=0; i<n; ++i)
    {
        cin>>a[i];
    }

    for(int i=0; i<m; ++i)
    {
        cin>>x>>y;
        if((a[x-1]+a[y-1])*(-1)>a[x-1]+a[y-1])
            u+=(a[x-1]+a[y-1])*(-1);
        else
            u+=a[x-1]+a[y-1];
    }

    cout<<u;
    return 0;
}