#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

ll a[100001];

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    	int n, m;
        	cin >> n >> m;
            	for (int i = 1; i <= n; i++)
                		cin >> a[i];
                        	ll rez = 0;
                            	while (m--)
                                	{
                                    		int x, y;
                                            		cin >> x >> y;
                                                    		ll d = a[x] + a[y];
                                                            		rez += max(d, -d);
                                                                    	}
                                                                        	cout << rez;
                                                                            }