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