#include<bits/stdc++.h>

using namespace std;

int n, m, x, y;
long long a[100006], huk;

int main()
{
	scanf("%d%d",&n,&m);
	
	for (int i=1;i<=n;i++)
	 scanf("%lld",&a[i]);
	 
	for (int i=0;i<m;i++) {
	scanf("%d%d",&x,&y);
	huk=huk+ abs( a[x]+ a[y]);	
	}
	
	printf("%lld",huk);
}