#include <bits/stdc++.h>

using namespace std;

int n,m,x,y;

int druzeljubivost[1000009];

long long br;

int main () {
    cin>>n>>m;

    for (int i=1;i<=n;i++){
        cin>>druzeljubivost[i];
    }

    for (int i=1;i<=m;i++){
        cin>>x>>y;
        br+= max(druzeljubivost[x] + druzeljubivost[y],
                  abs(-druzeljubivost[x] + (-druzeljubivost[y])));
    }

    cout<<br<<endl;

return 0;
}