#include <bits/stdc++.h>
using namespace std;
int v[1005];
int main() {
  int n, m, i, j, k, ans = 0;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; ++i) scanf("%d", &v[i]);
  for (i = 1; i <= m; ++i) {
    scanf("%d%d", &j, &k);
    ans += min(v[j], v[k]);
  }
  cout << ans << endl;
}
