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