#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
int n, m, w[2010];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
  }
  for (int i = 1, a, b; i <= m; i++) {
    scanf("%d%d", &a, &b);
    ans += min(w[a], w[b]);
  }
  printf("%d", ans);
  return 0;
}
