using System;

namespace Prijatelji
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, m, q, x2, x1, mn, mx;
            string[] x = Console.ReadLine().Split();
            n = int.Parse(x[0]);
            m = int.Parse(x[1]);
            int[] a = new int[n + 1];
            int[] b = new int[m + 1];
            int[] c = new int[m + 1];
            int[] y=new int[n + 1];
            x1 = 0;
            x2 = 0;
            int i = 1;
            while ( i <= n)
            {
                a[i]=int.Parse(Console.ReadLine());
                y[i] = 0;
                ++i;
            }
            mx = a[1];
            mn = mx;
            i = 1;
            while ( i <= n)
            {
                if (a[i] > mx)
                {
                    mx = a[i];
                }
                else
                {
                    if (a[i] < mn)
                    {
                        mn = a[i];
                    }
                }
                ++i;
            }
            i = 1;
            while (i <= m )
            {
                x = Console.ReadLine().Split();
                b[i] = int.Parse(x[0]);
                c[i] = int.Parse(x[1]);
                ++y[b[i]];
                ++y[c[i]];
                ++i;
            }
            q = 0;
            i = 1;
            while ( i <= m )
            {
                    x1 = Math.Abs(a[b[i]]);
                    x2 = Math.Abs(a[c[i]]);
                    if ((a[b[i]] >= 0) ^ (a[c[i]] < 0))
                    {
                        q += x1 + x2;

                    }
                    else
                    {
                        q += Math.Abs(x1 - x2);
                    }
                    ++i;
            }
            Console.WriteLine(q);

        }
    }
}