#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const double PI = 3.141592653589793238460;
void c_p_c() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
vector<pair<pair<int, int>, bool>> vis;
std::vector<pair<int, int>> adj;
void solve() {
  int n, m;
  cin >> n >> m;
  int v[n + 1];
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    adj.push_back({x, y});
  }
  long long int cost = 0;
  for (auto i : adj) {
    cost += min(v[i.first], v[i.second]);
  }
  cout << cost << '\n';
}
int main() {
  c_p_c();
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
