#include <bits/stdc++.h>
int a[1010];
int main() {
  int n, m, x, y, ans = 0, k;
  scanf("%d%d", &n, &m);
  for (k = 1; k <= n; k++) scanf("%d", &a[k]);
  for (k = 1; k <= m; k++) {
    scanf("%d%d", &x, &y);
    ans += std::min(a[x], a[y]);
  }
  printf("%d", ans);
}
