#include <bits/stdc++.h>
using namespace std;
int main() {
  long long count, m, k, t, i, n, j, a, b;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  t = 1;
  while (t--) {
    count = 0;
    cin >> n >> m;
    long long vSum[1001] = {0};
    for (i = 1; i <= n; i++) cin >> vSum[i];
    for (i = 1; i <= m; i++) {
      cin >> a >> b;
      count += (vSum[a] < vSum[b] ? vSum[a] : vSum[b]);
    }
    cout << count;
  }
  return 0;
}
