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