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