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