#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;

template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

int main() {
	const int INF = (1 << 29);

	int n, m;
	scanf("%d\n%d", &n, &m);

	vector<vector<int>> mat(n, vector<int>(n, INF));
	for(int i = 0; i < n; ++i) {
		mat[i][i] = 0;
	}

	for(int i = 0; i < m; ++i) {
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		--a; --b;
		mat[a][b] = c;
		mat[b][a] = d;
	}

	for(int k = 0; k < n; ++k) {
		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < n; ++j) {
				chmin(mat[i][j], mat[i][k] + mat[k][j]);
			}
		}
	}

	int x1, x2, y1, y2;
	scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
	--x1; --x2;
	printf("%d\n", y1 - (mat[x1][x2] + mat[x2][x1] + y2));

	return EXIT_SUCCESS;
}