#include <iostream>
#include<algorithm>

using namespace std;

long long druz[100010];

int main()
{
    int n,m;
    long long sreca=0;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>druz[i];
    }
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        if(druz[x-1]>=0 && druz[y-1]>=0)
        {
            sreca+=druz[x-1]+druz[y-1];
        }
        else if(druz[x-1]<0 && druz[y-1]>0)
        {
            if(abs(druz[x-1])>druz[y-1])
            {
                sreca-=druz[x-1]+druz[y-1];
            }
            else
            {
                sreca+=druz[x-1]+druz[y-1];
            }
        }
        else if(druz[y-1]<0 && druz[x-1]>0)
        {
            if(abs(druz[y-1])>druz[x-1])
            {
                sreca-=druz[x-1]+druz[y-1];
            }
            else
            {
                sreca+=druz[x-1]+druz[y-1];
            }
        }
        else
        {
            sreca-=druz[x-1]+druz[y-1];
        }

    }
    cout<<sreca;
}