#include <stdio.h>

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

    int a[n];
    int s = 0;

    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    for (int i = 0; i < m; i++) {
        int x, y;
        scanf("%d %d", &x, &y);

        int p = a[x - 1] + a[y - 1];
        int n = -a[x - 1] - a[y - 1];

        s += p > n ? p : n;
    }

    printf("%d", s);

    return 0;
}