#include <bits/stdc++.h>
using namespace std;
int b[1000 + 10];
struct node {
  int x, y;
} a[2000 + 10];
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    int sum = 0;
    for (int i = 0; i < n; i++) scanf("%d", &b[i]);
    for (int i = 0; i < m; i++) scanf("%d %d", &a[i].x, &a[i].y);
    for (int i = 0; i < m; i++) {
      sum += min(b[a[i].x - 1], b[a[i].y - 1]);
    }
    printf("%d\n", sum);
  }
  return 0;
}
