#include <iostream>
#include <vector>

using namespace std;

#define pb push_back
#define x first
#define y second
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

int main()
{
    IOS;
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) cin >> a[i];
    ll ans = 0;
    while (m--) {
        ll x, y;
        cin >> x >> y;
        --x, --y;
        ans += abs(a[x] + a[y]);
    }
    cout << ans;
    return 0;
}