#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;

    int sreca;

    sreca = 0;

    int druzaljubivost[n];

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

    while(m--)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        int nx = -1 * druzaljubivost[x];
        int px = druzaljubivost[x];
        int ny = -1 * druzaljubivost[y];
        int py = druzaljubivost[y];

        sreca = sreca + max(px + py, nx + ny);
    }

    cout << sreca;

    return 0;
}