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

namespace ConsoleApplication2
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = Convert.ToInt32(s[0]);
            int M = Convert.ToInt32(s[1]);
            int[] A = new int[N];
            int X, Y;
            string[] r;
            int z = 0;
            for (int i = 0; i < N; i++)
                A[i] = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i < M; i++)
            {
                r = Console.ReadLine().Split(' ');
                X = Convert.ToInt32(r[0]);
                Y = Convert.ToInt32(r[1]);
                z+=Math.Abs(A[X-1]+A[Y-1]);
            }
            Console.WriteLine(z);
        }
    }
}