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