using System;

namespace Zad_2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz1 = Console.ReadLine().Split();
            int N = int.Parse(ulaz1[0]);
            int M = int.Parse(ulaz1[1]);
            long sreca = 0;
            int[] druzeljubivost = new int[N];
            for (int i = 0; i < N; i++)
            {
                druzeljubivost[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < M; i++)
            {
                string[] ulaz2 = Console.ReadLine().Split();
                sreca += Math.Abs(druzeljubivost[int.Parse(ulaz2[0]) - 1] + druzeljubivost[int.Parse(ulaz2[1]) - 1]);
            }
            Console.WriteLine(sreca);
        }
    }
}