using System;

namespace prijatelji
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] s1 = s.Split();
            int n = int.Parse(s1[0]);
            int m = int.Parse(s1[1]);

            int us = 0;

            int[] a = new int[n];
            for(int i = 0; i < n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());

            }

            for (int i = 0; i < m; i++)
            {
                string s3 = Console.ReadLine();
                string[] s4 = s3.Split();
                int j1 = int.Parse(s4[0]) -1;
                int j2 = int.Parse(s4[1]) -1;

                if (a[j1] + a[j2] >= 0)
                {
                    us = us + a[j1] + a[j2];
                }
                else
                {
                    us = us - a[j1] - a[j2];
                }
            }
            Console.WriteLine(us);
        }
    }
}