#include <bits/stdc++.h>
using namespace std;
int m, n, a[1009];
long long ans;
int main() {
  while (scanf("%d%d", &n, &m) == 2) {
    for (int x = 0; x < n; x++) scanf("%d", &a[x]);
    ans = 0;
    for (int x = 0; x < m; x++) {
      int i, j;
      scanf("%d%d", &i, &j);
      i--;
      j--;
      ans += min(a[i], a[j]);
    }
    cout << ans << '\n';
  }
  return 0;
}
