#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

#pragma warning(disable:4996)

int x[30][30], D[30];
int N, M, a, b, c, d;
int s, t, p, q;

int main() {
	while (cin >> N) {
		cin >> M;
		for (int i = 0; i < M; i++) {
			scanf("%d,%d,%d,%d", &a, &b, &c, &d);
			x[a][b] = c;
			x[b][a] = d;
		}
		scanf("%d,%d,%d,%d", &t, &s, &p, &q);
		for (int i = 0; i < 30; i++) { D[i] = 1145141919; }
		D[s] = 0;
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= N; j++) {
				for (int k = 1; k <= N; k++) {
					if (x[j][k] != 0) {
						D[k] = min(D[k], D[j] + x[j][k]);
					}
				}
			}
		}
		p = p - q - D[t];
		for (int i = 0; i < 30; i++) { D[i] = 1145141919; }
		D[t] = 0;
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= N; j++) {
				for (int k = 1; k <= N; k++) {
					if (x[j][k] != 0) {
						D[k] = min(D[k], D[j] + x[j][k]);
					}
				}
			}
		}
		cout << p - D[s] << endl;
	}
	return 0;
}