#include<iostream>
using namespace std;
int main()
{
    int n, m;
    cin>>n>>m;
    int a[n];
    for(int i=0; i<n; i++) cin>>a[i];
    int sum=0;
    int x, y;
    for(int i=0; i<m; i++)
    {
        cin>>x>>y;
        x--;
        y--;
        if(a[x]+a[y]>=0) sum+=a[x]+a[y];
        else sum-=a[x]+a[y];
    }
    cout<<sum;
}