#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const double Pi = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;
int a[1007];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
  }
  int res = 0;
  for (int j = (0); j < (m); ++j) {
    int A, B;
    cin >> A >> B;
    res += min(a[A - 1], a[B - 1]);
  }
  cout << res << endl;
  return 0;
}
