#include <bits/stdc++.h>
using namespace std;
int min(int x, int y) {
  if (x < y)
    return x;
  else
    return y;
}
int main() {
  int n, i, a[1111], x, y, m;
  while (~scanf("%d %d", &n, &m)) {
    int sum = 0;
    for (i = 1; i <= n; i++) scanf("%d", &a[i]);
    while (m--) {
      scanf("%d %d", &x, &y);
      sum += min(a[x], a[y]);
    }
    printf("%d\n", sum);
  }
  return 0;
}
