#include <iostream>
#include <cstdio>

using namespace std;

int main() {
	int n; 
	int m; 
	int a, b, c, d, s, g, V, P;
	int cost, reward;
	scanf("%d%d", &n, &m);
	int K[n][n];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			K[i][j] = 100010010;
	}
	for (int i = 0; i < m; i++) {
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		a--; b--;
		K[a][b] = c;
		K[b][a] = d;
	}
	// FoyldWarshall
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (K[i][j] > K[i][k] + K[k][j])
					K[i][j] = K[i][k] + K[k][j];
			}
		}
	}
	scanf("%d,%d,%d,%d", &s, &g, &V, &P);
	s--; g--;
	cost = K[s][g] + K[g][s];
	reward = V - P - cost;
	cout << reward << endl;
}
