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

namespace ConsoleApplication551
{
    class Program
    {
        
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int zbir = 0;
            int[] a = new int[n+1];
            for(int i = 1; i <= n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());

            }
            int x, y;
            for (int i = 1; i <= m; i++)
            {
                string[] s1 = Console.ReadLine().Split();
                x = int.Parse(s1[0]);
                y = int.Parse(s1[1]);
                zbir += Math.Abs(a[x] + a[y]);
            }
            Console.WriteLine(zbir);
        }
    }
}