#include <string>
#include <iostream>
#include <vector>
#include <stdlib.h> 

using namespace std;

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