#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int v[MAXN];
int n, m, res;
int main() {
  if (0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  };
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    res += min(::v[u], ::v[v]);
  }
  cout << res << endl;
  return 0;
}
