#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	int n, m;
	long long x, y, s; 

	s = 0;
    cin >> n >> m;
    long long A[n];

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

    for (int i = 0; i < m; i++)
    {
        cin >> x >> y;
        if (abs(A[x - 1]) >= abs(A[y - 1]))
        {
            if (A[x - 1] > 0)
                s = s + A[x - 1] + A[y - 1];
            else if (A[x - 1] < 0)
                s = s - A[x - 1] - A[y - 1];
        }
        else if (A[y - 1] > 0)
            s = s + A[x - 1] + A[y - 1];
        else if (A[y - 1] < 0)
            s = s - A[x - 1] - A[y - 1];
    }
    cout << s;	
	
	return 0;
}