#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    ll druzeljubivost[n+1];
    for(int i = 0;i <= n;i++) druzeljubivost[i] = 0;
    for(int i = 1;i <= n;i++)
        cin >> druzeljubivost[i];
    int u, v;
    ll sreca = 0;
    for(int i = 1;i <= m;i++){
        cin >> u >> v;
        sreca += max(druzeljubivost[u] + druzeljubivost[v], druzeljubivost[u]*(-1) + druzeljubivost[v]*(-1));
    }
    cout << sreca;
    return 0;
}