#include <bits/stdc++.h>
using namespace std;
template <typename T, size_t N>
struct ma : array<T, N> {
  T &operator[](size_t n) { return (*static_cast<array<T, N> *>(this))[n]; }
};
template <class T>
string to_str(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}
template <>
string to_str<long double>(const long double &a) {
  ostringstream os;
  os.precision(10);
  os.setf(ios::fixed);
  os << a;
  return os.str();
}
template <class T>
T from_str(const string &s) {
  istringstream is;
  T val;
  is >> val;
  return val;
}
int cond = (long long)0;
void solve() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> co(n);
  for (auto i = (0); i < (n); ++i) scanf("%d", &co[i]);
  long long ret = 0;
  for (auto i = (0); i < (m); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    ret += min(co[a], co[b]);
  }
  cout << ret << endl;
}
void brute() {}
void gen(int i, int n, int k) {}
int main(int argc, char **argv) {
  ios::sync_with_stdio(false);
  vector<string> args;
  int nr_test = -1;
  int t = 1;
  for (auto i = (1); i <= (argc - 1); ++i) args.push_back(argv[i]);
  for (auto &it : (args))
    if (it == "q") cond = 10000000;
  for (auto &it : (args))
    if (it == "all") t = 1000;
  for (auto &it : (args))
    if (atoi(it.c_str()) > 0) nr_test = atoi(it.c_str());
  for (auto &it : (args))
    if (it == "b") {
      brute();
      return 0;
    }
  for (auto &it : (args))
    if (it == "g" && args.size() >= 4) {
      gen(atoi(args[1].c_str()), atoi(args[2].c_str()), atoi(args[3].c_str()));
      return 0;
    }
  for (auto i = (1); i <= (t); ++i) {
    if (nr_test == -1 || i <= nr_test) solve();
  }
  return 0;
}
