#include <cmath>
#include <algorithm>
#include <iostream>
#include <algorithm>


using namespace std;

int f1[100100];


int main()
{
    ios_base::sync_with_stdio(false);

    long long sn=0;
    int o1, p1;
    int l, r;
    cin>>o1>>p1;


    for(int j = 1; j<=o1; j++)
    {
        cin>>f1[j];
    }

    for(int j = 1; j<=p1; j++)
    {

        cin>>l>>r;
        sn+= abs(f1[l] + f1[r]);
    }
    cout <<sn<<endl;


    return 0;
}