#include <stdio.h>
#include <stdlib.h>

long abs(long a)
{
    if(a >= 0)
        return a;
    else
        return -a;
}

int main()
{
    long n, m;
    scanf("%ld", &n);
    scanf("%ld", &m);

    long a[n];
    for(long i = 0; i < n; i++)
        scanf("%ld", &a[i]);

    long b[m][2], rez = 0;
    for(long i = 0; i < m; i++)
    {
        scanf("%ld", &b[i][0]);
        scanf("%ld", &b[i][1]);

        rez += abs(a[b[i][0]-1] + a[b[i][1]-1]);
    }
    printf("%ld", rez);
    return 0;
}