#include <iostream>
using namespace std;
int main()
{
  int n; int m; cin>>n>>m; int p; int q; int z; long long int c=0;
  int d[n]; //int a[100000];
  for(int i = 1; i<=n; i++){
      cin>>d[i];
  }
  for(int i = 0; i<m; i++){
      cin>>p>>q;
      if(d[p]<d[q]){
          z = p; p = q; q = z;
      }
      if(-d[q]>d[p]) c-=d[q]+d[p];
      else c+=d[q]+d[p];
  }
  cout<<c;
}