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