#include <iostream>
#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0);
	int n,brpoz;
	cin>>n>>brpoz;
	int a[100003];
	long long int suma = 0;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<brpoz;i++)
	{
		int x,y;
		cin>>x>>y;
		int povecavanje=(a[x-1]+a[y-1]<(-a[x-1]-a[y-1])) ? (-a[x-1]-a[y-1]): (a[x-1]+a[y-1]);
		suma=suma+povecavanje;
	}
	cout<<suma;
	return 0;
}