#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<ll> vec(n);
    int x, y;
    ll sum = 0, s;
    for(int i = 0; i < n; ++i){
        cin >> vec[i];
    }
    for(int i = 0; i < m; ++i){
        cin >> x >> y;
        --x;
        --y;
        s = vec[x] + vec[y];
        if(s < 0){
            sum -= s;
        }
        else{
            sum += s;
        }
    }
    cout << sum << endl;
    return 0;
}