#include <bits/stdc++.h>

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

    int sreca[100005];
    for(int i = 0; i<n; i++)
        scanf("%d", &sreca[i]);

    int result = 0;

    for(int i = 0; i<m; i++)
    {
        int a, b;
        scanf("%d %d", &a, &b);
        a--; b--;

        if((sreca[a] > 0 && sreca[b] > 0) || (sreca[a] < 0 && sreca[b] < 0))
            result += abs(sreca[a]) + abs(sreca[b]);
        else
            result += abs(abs(sreca[a]) - abs(sreca[b]));
    }

    printf("%d", result);
    return 0;
}