#include <bits/stdc++.h>

using namespace std;

int mapData[21][21];

void init(int n) {
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			mapData[i][j] = 1001;
		}
	}
}

void solve(int n) {
	for (int k = 1; k < n; k++) {
		for (int i = 1; i < n; i++) {
			for (int j = 1; j < n; j++) {
				if (mapData[i][j] > mapData[i][k] + mapData[k][j]) {
					mapData[i][j] = mapData[i][k] + mapData[k][j];
				}
			}
		}
	}
}

int main(void) {
	int n, m, u, v, V, P;

	cin >> n >> m;
	init(n+1);
	for (int i = 0; i < m; i++) {
		scanf("%d,%d,%d,%d", &u, &v, &V, &P);
		mapData[u][v] = V;
		mapData[v][u] = P;
	}
	scanf("%d,%d,%d,%d", &u, &v, &V, &P);

	solve(n+1);
	cout << V - P - mapData[u][v] - mapData[v][u] << endl;

	return 0;
}
