#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;
typedef long long int lint;

#define INF 10000000

int* mk_vector(int size, int init)
{
	int* vec = new int[size];
	for (int i = 0; i < size; i++) {
		vec[i] = init;
	}
	return vec;
}

int** mk_matrix(int size, int init)
{
	int** mat = new int*[size];
	for (int i = 0; i < size; i++) {
		mat[i] = new int[size];
	}
	for (int i = 0; i < size; i++) {
		for (int j = 0; j < size; j++) {
			mat[i][j] = init;
		}
	}
	return mat;
}

int Dijkstra(int size, int start, int goal, int** cost)
{
	//??????S
	bool* S = new bool[size + 1];
	//??????V-S
	bool* V = new bool[size + 1];
	//D[i] : i??????????????????????°??????????
	int* D = mk_vector(size + 1, INF);

	for (int i = 1; i <= size; i++) {
		S[i] = false;
		V[i] = true;
	}

	S[start] = true;
	V[start] = false;
	for (int i = 1; i <= size; i++) {
		if (S[i]) continue;
		D[i] = cost[start][i];
	}

	for (int i = 1; i <= size - 1; i++) {
		//D[w] ???????°???¨?????? w in V-S ????±???????
		int w;
		int minD = INF;
		for (int i = 1; i <= size; i++) {
			if (!V[i]) continue;
			if (D[i] < minD) {
				minD = D[i];
				w = i;
			}
		}
		//S = S cup {w}
		S[w] = true;
		V[w] = false;
		for (int i = 1; i <= size; i++) {
			if (!V[i]) continue;
			D[i] = min(D[i], D[w] + cost[w][i]);
		}
	}

	int ret = D[goal];

	delete[] S;
	delete[] V;
	delete[] D;

	return ret;
}

void AOJ0117()
{
	int n, m;
	cin >> n >> m;
	int** cost = mk_matrix(n + 1, INF);
	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; // a to b
		cost[b][a] = d; // b to a
	}
	int start, goal, V, P;
	scanf("%d,%d,%d,%d", &start, &goal, &V, &P);

	//print(cost, n);

	int ans = V - P - Dijkstra(n, start, goal, cost) - Dijkstra(n, goal, start, cost);

	cout << ans << endl;

	return;
}

int main()
{
	AOJ0117();
	return 0;
}