using System;

namespace PRIJATELJI
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            int n = int.Parse(unos[0]);
            int m = int.Parse(unos[1]);

            int[] d = new int[n];
            for (int i = 0; i < n; i++)
                d[i] = int.Parse(Console.ReadLine());

            int s = 0;

            for(int i = 0; i < m; i++)
            {
                unos = Console.ReadLine().Split();
                int m1 = int.Parse(unos[0]) - 1;
                int m2 = int.Parse(unos[1]) - 1;

                int p = d[m1] + d[m2];
                int np = d[m1] * (-1) + d[m2] * (-1);

                s += Math.Max(p, np);
            }

            Console.WriteLine(s);
        }
    }
}