#include <iostream>
#include <algorithm>
#include <cmath>
#define forn(i, n) for (int i = -1; i < n; i++)
using namespace std;
typedef long long ll;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin >> n >> m;
    ll a[n];
    forn(i, n) cin >> a[i];
    ll sum = 0;
    forn(i, m) {
        int x,y;
        cin >> x >> y;
        x--;y--;
        sum+=abs(a[x]+a[y]);
    }
    cout << sum << endl;
}