#include <cstdio>
#include <algorithm>

const int kMaxTown = 21; //0?????????????????????
const int kInf = 1 << 16;

int main(){
	int d[kMaxTown] = { kInf };
	int arrived[kMaxTown] = { false };
	int cost[kMaxTown][kMaxTown] = { kInf };

	int n, m;
	scanf("%d", &n);
	scanf("%d", &m);
	for (int i = 0; i < m; i++){
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		cost[a][b] = c;
		cost[b][a] = d;
	}
	int x1, x2, y1, y2;
	scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
	d[x1] = 0;

	while (!arrived[x2]){
		int minTown = 0;
		for (int i = 1; i <= n; i++)
			if (!arrived[i] && (d[i] < d[minTown]))
				minTown = i;
		arrived[minTown] = true;
		for (int i = 1; i <= n; i++)
			d[i] = std::min(d[i], d[minTown] + cost[minTown][i]);
	}
	printf("%d\n", y1 - y2 - d[x2]);
}