// Luka Mitrovic
// Zadatak 2

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

int main() {

	int n,m;
	long long zbir = 0;

	cin >> n >> m;

	vector<int> druzeljubivost(n+1);

	for (int i = 1; i <= n; i++) {
		cin >> druzeljubivost[i];
	}

	for (int i = 1; i <= m; i++) {
		int a,b;
		cin >> a >> b;

		a = druzeljubivost[a];
		b = druzeljubivost[b];

		int mult = 1;

		if (abs(a) > abs(b) && a < 0) {
			mult = -1;
		} else if (abs(b) > abs(a) && b < 0) {
			mult = -1;
		}

		zbir += a*mult + b*mult;
	}

	cout << zbir;

	return 0;
}