#include <iostream>

using namespace std;

int main()
{
    int n,m;
    int maxSreca = 0;
    cin >> n >> m;
    int parovi[m][2];
    int ucesnici[n];
    for (int i = 0; i < n; i++)
    {
        cin >> ucesnici[i];
    }
    for (int i = 0; i < m; i++)
    {
        cin >> parovi[i][0] >> parovi[i][1];
    }
    for (int i = 0; i < m; i++)
    {
        int zbirDruzeljubivosti = ucesnici[parovi[i][0] - 1] + ucesnici[parovi[i][1] - 1];
        if(zbirDruzeljubivosti >= -1 * zbirDruzeljubivosti) maxSreca += zbirDruzeljubivosti;
        else maxSreca -= zbirDruzeljubivosti;
    }
    cout << maxSreca;
    return 0;
}