#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    uint64_t sum = 0;
    int n, m;

    cin >> n >> m;

    int a[n + 1];

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    int x, y;

    for (int i = 0; i < m; i++) {
        cin >> x >> y;

        sum += abs(a[x] + a[y]);
    }

    cout << sum << "\n";
}