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

int main()
{
	long long s = 0;
	long long a,b;
	int n,m;
	cin >>n>>m;
	long long x[n];
	for(int i = 0; i<n; i++) cin >>x[i];
	for(int i = 0; i<m; i++)
	{
		cin >>a >>b;
		if(abs(x[a-1])>=abs(x[b-1])) 
		{
			if(x[a-1]>0) s = s+x[a-1] + x[b-1];
			else if (x[a-1]<0)s = s-x[a-1] - x[b-1];
		}
		else if(x[b-1]>0) s = s+x[a-1] + x[b-1];
			 else if(x[b-1]<0) s = s-x[a-1] - x[b-1];
	}
	cout <<s;
	return 0;
}