#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int m, n, br1, br2, sr = 0;
    cin >> m >> n;
    long int a[m];

    for(int i = 0; i < m; i++)
        cin >> a[i];

    for(int i = 0; i < n; i++){
        cin >> br1 >> br2;
        if(abs(a[br1-1]) >= abs(a[br2-1])){
            if(a[br1-1] >= 0)
                sr += a[br1-1] + a[br2-1];
            else sr += -a[br1-1] - a[br2-1];
        }
        else{
            if(a[br2-1] >= 0)
                sr += a[br1-1] + a[br2-1];
            else sr += -a[br1-1] - a[br2-1];
        }

    }
    cout << sr;
    return 0;
}