#include <bits/stdc++.h>
using namespace std;
int n, m;
int weight[1010];
vector<int> edge[1010];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%d", weight + i);
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    int from, to;
    scanf("%d%d", &from, &to);
    ans += min(weight[from], weight[to]);
  }
  cout << ans;
  return 0;
}
