#include <iostream>
#include <cmath>

using namespace std;

int main(){
	int n,m,x,y;
	cin>>n>>m;
	double A[n];
	double sreca=0;
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	for(int i=0;i<m;i++){
		cin>>x>>y;
		sreca+=abs(A[x-1]+A[y-1]);
	}
	cout<<sreca;
}