program project2;
  var
    n, m, i, t1, t2, ukup:integer;
    a:array[1..100000] of longint;
begin
  ukup:=0;
  Read(n);
  ReadLn(m);
  for i:=1 to N do ReadLn(a[i]);
  for i:=1 to M do
  begin
    Read(t1);
    ReadLn(t2);
    if (a[t1]+a[t2]>=0) then ukup:=ukup+a[t1]+a[t2]
    else ukup:=ukup-a[t1]-a[t2];
  end;
  Write(ukup);
  ReadLn();
end.