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