using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication153
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int[] a = new int[100000];
            string s = Console.ReadLine();
            string[] r = s.Split(' ');
            int N = int.Parse(r[0]);
            int M = int.Parse(r[1]);
            int S = 0;
            for(int i=0;i<N;i++)
            {
                int k = int.Parse(Console.ReadLine());
                a[i] = k;
            }
            for(int i=0;i<M;i++)
            {
                string s1 = Console.ReadLine();
                string[] r1 = s1.Split(' ');
                int n1 = int.Parse(r1[0]);
                int n2 = int.Parse(r1[1]);
                S += Math.Abs(a[n2 - 1] + a[n1 - 1]);
            }
            Console.WriteLine(S);
            Console.ReadLine();
        }
    }
}