#include <bits/stdc++.h>
using namespace std;
int v[1005];
int main() {
  int n, m, i, ans, x, y;
  while (cin >> n >> m) {
    ans = 0;
    for (i = 1; i <= n; i++) cin >> v[i];
    for (i = 0; i < m; i++) {
      cin >> x >> y;
      ans += min(v[x], v[y]);
    }
    cout << ans << endl;
  }
  return 0;
}
