#include <bits/stdc++.h>
#define K int(1e5 + 10)
#define INF ll(1e18)
#define MOD (long long)(1e9 + 7)
#define endl "\n"
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;

void solve(){
    int n, m;
    cin >> n >> m;
    vector<ll> d(n);
    for (ll &i : d) cin >> i;
    int a, b;
    ll ans = 0;
    while (m--){
        cin >> a >> b;
        --a, --b;
        ans += max(d[a] + d[b], -d[a] - d[b]);
    }
    cout << ans << endl;
}
 
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
 
    return 0;
}