#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k;
  int n, m, a[1123], c, b, re = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> a[i + 1];
  for (i = 0; i < m; i++) {
    cin >> c >> b;
    re += min(a[c], a[b]);
  }
  cout << re << endl;
  return 0;
}
