#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n + 1);
  v[0] = 0;
  int i;
  for (i = 1; i <= n; i++) cin >> v[i];
  long long int ans = 0;
  for (i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    ans = ans + min(v[x], v[y]);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  auto start = high_resolution_clock::now();
  int i, t = 1;
  for (i = 1; i <= t; i++) solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
}
