#include <iostream>
#include <cmath>

using namespace std;

int d[100001];

int main(void)
{
    ios::sync_with_stdio(0);

    int n, m, a, b;
    int rez = 0;

    cin >> n >> m;
    for( int i = 1; i <= n; i++ )
        cin >> d[i];

    for( int i = 0 ; i < m; i++ )
    {
        cin >> a >> b;
        rez += max((d[a]+d[b]), (-d[a]-d[b]));
    }

    cout << rez;

    return 0;
}