#include <bits/stdc++.h>
using namespace std;
vector<int> v[1010];
stack<int> order;
int val[1010];
bool mark[1010];
vector<int> v1[1010];
void dfs(int cur) {
  int i;
  mark[cur] = 1;
  for (i = 0; i < v[cur].size(); ++i) {
    if (!mark[v[cur][i]]) {
      dfs(v[cur][i]);
    }
  }
  order.push(cur);
}
int main() {
  int n, m, i, x, y, cur, ans = 0;
  scanf("%d", &n);
  scanf("%d", &m);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &val[i]);
  }
  for (i = 0; i < m; ++i) {
    scanf("%d", &x);
    scanf("%d", &y);
    if (val[x] > val[y])
      v[x].push_back(y);
    else
      v[y].push_back(x);
    v1[x].push_back(y);
    v1[y].push_back(x);
  }
  for (i = 1; i <= n; ++i) mark[i] = 0;
  for (i = 1; i <= n; ++i) {
    if (!mark[i]) {
      dfs(i);
    }
  }
  for (i = 0; i <= n; ++i) mark[i] = 0;
  while (!order.empty()) {
    cur = order.top();
    order.pop();
    mark[cur] = 1;
    for (i = 0; i < v1[cur].size(); ++i) {
      if (!mark[v1[cur][i]]) {
        ans = ans + val[v1[cur][i]];
      }
    }
  }
  printf("%d\n", ans);
}
