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

namespace ConsoleApp2
{
    class Program
    {
        static int resi(int[] a, int[] brp)
        {
            int sum = 0;
            for (int i = 0; i < a.Length; i++)
                sum = sum + a[i] * brp[i];
            return sum;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int[] a = new int[n];
            int sum = 0;
            int br = 0;
            int[,] b = new int[m, 2];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
                if (a[i] < 0) br++;
            }
            for (int i=0; i<m; i++)
            {
                s = Console.ReadLine().Split(' ');
                b[i, 0] = int.Parse(s[0]) - 1;
                b[i, 1] = int.Parse(s[1]) - 1;
            }
            int[] brp = new int[n];
            for (int i = 0; i < n; i++)
                brp[i] = 0;
            for (int i = 0; i < m; i++)
            {
                brp[b[i, 0]]++;
                brp[b[i, 1]]++;
            }
            if (br == 0) sum = resi(a, brp);
            Console.WriteLine(sum);
        }
    }
}