#include <bits/stdc++.h>
using namespace std;
int n, m;
int edge[1005];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> edge[i];
  }
  int sum = 0;
  int tmp1, tmp2;
  for (int i = 0; i < m; i++) {
    cin >> tmp1 >> tmp2;
    sum += min(edge[tmp1], edge[tmp2]);
  }
  cout << sum << endl;
  return 0;
}
