#include <iostream>
#define ll long long

using namespace std;

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

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