#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int v[N];
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
  }
  long long sum = 0;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    cin >> x >> y;
    sum += (long long)min(v[x], v[y]);
  }
  cout << sum;
}
