#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long
#define PB push_back
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define MAX 1000
#define Fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define w(a) cout<<#a<<" : "<<a<<endl;

int main()
{
    Fast;
    int n,m;
    cin>>n>>m;
    ll a[n];
    for(int i=0; i<n; ++i)
    {
        cin>>a[i];
    }
    vector<pair<int,int>> veze(m);
    for(int i=0; i<m; ++i)
    {
        cin>>veze[i].F>>veze[i].S;
    }
    ll ans=0;
    for(auto veza:veze)
    {
        int i=veza.F-1,j=veza.S-1;
        ll d1=a[i],d2=a[j];
        ans+=abs(d1+d2);
    }
    cout<<ans;
    return 0;
}