#include <bits/stdc++.h>
using namespace std;
long long LLMAX = 9223372036854775807LL;
const int MOD = 1000000000;
const int maxn = 55555;
int v[2222];
int n, m;
int main() {
  scanf("%d %d", &(n), &(m));
  for (int(i) = 0; (i) < (int)(n); ++(i)) scanf("%d", &(v[i + 1]));
  long long ans = 0;
  for (int(i) = 0; (i) < (int)(m); ++(i)) {
    int a, b;
    scanf("%d %d", &(a), &(b));
    ans += min(v[a], v[b]);
  }
  cout << ans << endl;
}
