#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const int INF = 1000000000;
const int MAX = 3000;
const int MAX2 = 7000;
const int BASE = 1000000000;
int n, m;
int A[MAX];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = (0); i < (n); ++i) scanf("%d", &A[i]);
  int res = 0;
  for (int i = (0); i < (m); ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u;
    --v;
    res += min(A[u], A[v]);
  }
  printf("%d\n", res);
  return 0;
}
