#include <cstdio>

int main () {
    long N,M,sreca=0,M1,M2,Mvar;
    scanf("%ld%ld",&N,&M);
    long Niz[N+2];
    for (long i=0;i<N;i++) {
        scanf("%ld",&Niz[i]);
    }
    for (int i=0;i<M;i++) {
    scanf("%ld%ld",&M1,&M2);
    if (Niz[M1-1]<0 || Niz[M2-1]<0) {
        Mvar=-1;
    }
    else Mvar=1;
    sreca=sreca+(Niz[M1-1]*Mvar);
    sreca=sreca+(Niz[M2-1]*Mvar);
    }
    printf("%ld",sreca);

    return 0;
}