#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ins insert
#define vi vector<int>
const int mxN = 1e9;
const ll mod = 1e9 + 7;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<ll> a(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    ll ans = 0;
    for (int i = 0; i < m; i++)
    {
        ll x, y;
        cin >> x >> y;
        //fix
        //ako su oba pozitivna  1+2
        //ako su oba negativna  abs(1+2)
        //1 poz 1 neg 1+2 V abs(1+2)
        // => abs(a[x]+a[y]);
        ans += abs(a[x] + a[y]);
    }
    cout << ans;
    return 0;
}