#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    int m;
    cin >> n;
    cin >> m;
    int *a = new int[n + 1];
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }

    int s = 0;
    for(int i = 1; i <= m; i++){
        int x;
        int y;
        cin >> x;
        cin >> y;
        if(a[x] > 0 && a[y] > 0) s += a[x] + a[y];
        else if(a[x] < 0 && a[y] < 0) s -= a[x] + a[y];
        else s += abs(a[x] + a[y]);
    }

    cout << s;
    return 0;
}