#include <iostream>
#include <algorithm>

using namespace std;

int *read(int n) {
    int *t = new int[n];
    for (int i = 0; i < n; i++)
        scanf("%d", t + i);
    return t;
}

int main() {
    int n, m, *a;
    long long s = 0;
    cin >> n >> m;
    a = read(n);

    for (int i = 0; i < m; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        x--;
        y--;
        s += abs(a[x] + a[y]);
    }
    cout << s;

    delete[] a;
    return 0;
}