#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double pi = acos(-1.0);
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tt;
  tt = 1;
  while (tt--) {
    long long n, m;
    cin >> n >> m;
    long long cost[n + 2];
    for (long long i = 0; i < n; i += 1) cin >> cost[i + 1];
    long long ans = 0;
    for (long long i = 0; i < m; i += 1) {
      long long p, q;
      cin >> p >> q;
      ans += min(cost[p], cost[q]);
    }
    cout << ans << "\n";
  }
  return 0;
}
