#include <bits/stdc++.h>
using namespace std;
pair<int, long long> p[100010];
int n, m, x, y, v[2010], vvv[2010];
long long in[2010], out[2010], vv[2010];
vector<int> g[100010];
int mark[2010];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
  long long ans = 0;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    ans += min(v[x], v[y]);
  }
  cout << ans << endl;
  return 0;
}
