using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
        int N, M;
        double Dr = 0;
        string[] inp = Console.ReadLine().Split(' ');
        N = int.Parse(inp[0]);
        M = int.Parse(inp[1]);
        int[] A = new int[N];
        int i = 0;
        while (i < N)
        {
            A[i] = int.Parse(Console.ReadLine());
            i++;
        }
        i = 0;
        while (i < M)
        {   
            inp = Console.ReadLine().Split(' ');
            Dr += Math.Abs(A[int.Parse(inp[0])-1] + A[int.Parse(inp[1])-1]);
            i++;
        }
        Console.WriteLine(Dr);
    }
}