using System;

namespace ConsoleApp23
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int n = int.Parse(s.Substring(0, s.IndexOf(" ")));
            int m = int.Parse(s.Substring(s.IndexOf(" ")));
            int uksreca = 0; int znak = 0;
            int[] sreca = new int[n];
            int k1, k2;

            for (int i = 0; i < n; i++)
            {
                sreca[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < m; i++)
            {
                s = Console.ReadLine();
                k1 = int.Parse(s.Substring(0, s.IndexOf(" "))) - 1;
                k2 = int.Parse(s.Substring(s.IndexOf(" "))) - 1;
                if (Math.Abs(sreca[k1]) > Math.Abs(sreca[k2]))
                {
                    if (sreca[k1] < 0)
                        znak = -1;
                    else znak = 1;
                }
                else
                {
                    if (sreca[k2] < 0)
                        znak = -1;
                    else znak = 1;
                }
                uksreca += znak*sreca[k1];
                uksreca += znak*sreca[k2];
            }
            Console.WriteLine(Math.Abs(uksreca));

        }
    }
}