#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, m;
int D[20][20];
int V;
const int INF = 1 << 20;

void solve()
{
	for (int k = 0; k < V; k++)
	{
		for (int i = 0; i < V; i++)
		{
			for (int j = 0; j < V; j++)
			{
				D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
			}
		}
	}
}

int main()
{
	fill(D[0], D[0] + 400, INF);
	char comma;
	cin >> n;
	V = n;
	cin >> m;
	for (int i = 0; i < m; i++)
	{
		int a, b, c, d;
		cin >> a >> comma >> b >> comma >> c >> comma >> d;
		a--; b--;
		D[a][b] = c;
		D[b][a] = d;
	}
	int x1, y1, x2, y2;
	cin >> x1 >> comma >> x2 >> comma >> y1 >> comma >> y2;
	solve();
	cout << y1 - D[--x1][--x2] - D[x2][x1] - y2 << endl;
	cin >> n;
	return 0;
}