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