#include <bits/stdc++.h>
const int MAXN = 1005;
const int INF = 1e9;
int value[MAXN];
int main() {
  int n, m;
  (scanf("%d%d", &n, &m) ?: 0);
  for (int i = 0; i < n; i++) (scanf("%d", &value[i]) ?: 0);
  int result = 0;
  for (int i = 0; i < m; i++) {
    int u, v;
    (scanf("%d%d", &u, &v) ?: 0);
    u--, v--;
    result += std::min(value[u], value[v]);
  }
  printf("%d\n", result);
}
