#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main()
{
    int N, M;
    scanf("%d %d", &N, &M);

    vector<ll> A(N);
    for (int i = 0; i < N; ++i) scanf("%lld", &A[i]);

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

        if ((ll)abs(A[x-1]) > (ll)abs(A[y-1])) {
            if (A[x-1] < 0) {
                sol += A[x-1]*(-1);
                sol += A[y-1]*(-1);
            } else {
                sol += A[x-1];
                sol += A[y-1];
            }
        } else {
            if (A[y-1] < 0) {
                sol += A[y-1]*(-1);
                sol += A[x-1]*(-1);
            } else {
                sol += A[y-1];
                sol += A[x-1];
            }
        }

    }

    printf("%lld", sol);

    return 0;
}