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