#include <bits/stdc++.h>

using namespace std;

int main()
{
	int maxSreca = 0;
	int n, m;
	cin >> n; cin >> m;
	vector<int> druzeljubivosti(n);
	vector<int> brojPn(n);
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		druzeljubivosti[i] = a;
		brojPn[i] = 0;
	}
	for (int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x;
		cin >> y;
		x = x-1;
		y = y-1;
		int dx = druzeljubivosti[x];
		int dy = druzeljubivosti[y];
		if (abs(dx) > abs(dy))
		{
			if (dx < 0)
			{
				brojPn[x]--;
				brojPn[y]--;
			}
			else
			{
				brojPn[x]++;
				brojPn[y]++;
			}
		}
		else
		{
			if (dy < 0)
			{
				brojPn[x]--;
				brojPn[y]--;
			}
			else
			{
				brojPn[x]++;
				brojPn[y]++;
			}
		}
	}
	for (int i = 0; i < n; i++)
	{
		maxSreca +=  druzeljubivosti[i] * brojPn[i];
	}
	cout << maxSreca;
	return 0;
}