#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long en[n];
  for (long long i = 0; i < n; ++i) cin >> en[i];
  long long ans = 0;
  for (long long i = 0; i < m; ++i) {
    long long x, y;
    cin >> x >> y;
    ans += min(en[x - 1], en[y - 1]);
  }
  cout << ans;
}
