#include <bits/stdc++.h>
#define pii pair <int, int>
#define ull unsigned long long
#define ll long long
using namespace std;

const int N=100005;
long a[N];

int main()
{
    int n, m;
    cin>>n>>m;
    for (int i=1; i<=n; i++)
    {
        cin>>a[i];
    }

    int x, y;
    ll sum=0;
    for (int i=0; i<m; i++)
    {
        cin>>x>>y;
        if (a[x]+a[y]<0)
        {
            sum-= (a[x]+a[y]);
        }
        else sum+=(a[x]+a[y]);

    }
    cout<<sum;


    return 0;
}