#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0;i<(n);i++)

int N, M, A, B, C, D,s,g,V,P;
int K[32][32];
const int inf = 1001001001;


int main() {
	rep(i, 32) {
		rep(j, 32) K[i][j] = inf;
	}
	cin >> N;
	cin.ignore();
	cin >> M;
	rep (i,M) {
		cin >> A;
		cin.ignore();
		cin >> B;
		cin.ignore();
		cin >> C;
		cin.ignore();
		cin >> D;
		K[A][B] = C;
		K[B][A] = D;
	}
	cin >> s;
	cin.ignore();
	cin >> g;
	cin.ignore(); 
	cin >> V;
	cin.ignore();
	cin>> P;
	
	for (int k = 1; k <= N; k++) {
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= N; j++) {
				if (K[i][j] > K[i][k] + K[k][j]) K[i][j] = K[i][k] + K[k][j];
			}
		}
	}
	int ans = V - P - K[s][g] - K[g][s];
	cout << ans << endl;
	return 0;
}
