#include<iostream>

using namespace std;

int main()
{
    int N, M, maxV = 0;
    cin >> N >> M;
    int a[N];
    for(int i = 0; i<N; i++)
    {
        cin >> a[i];
    }
    for(int i = 0; i < M; i++)
    {
        int c, b, x, y;
        cin >> c >> b;
        x = a[c-1] + a[b-1];
        y = -a[c-1] - a[b-1];
        if(x > y) maxV += x;
        else maxV += y;
    }
    cout << maxV;
    return 0;
}