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

int weights[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, m;
    cin>>n;
    cin>>m;

    for(int i = 0 ; i < n; i++)
        cin>>weights[i];

    int sum = 0;
    int first, second;

    for(int i = 0; i < m; i++){
        cin>>first>>second;
        sum += abs(weights[first-1] + weights[second-1]);
    }

    cout<<sum<<"\n";

    return 0;
}