#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 66;
int m, n;
int c[N];
int main() {
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) cin >> c[i];
    int ans = 0;
    for (int i = 0; i < m; i++) {
      int a, b;
      cin >> a >> b;
      ans += min(c[a], c[b]);
    }
    cout << ans << endl;
  }
}
