module AOJ_Volume0117;

import std.stdio,std.string,std.conv,std.algorithm;

int main()
{
	int n,m;
	int cost[21][21];
	foreach(i;0..21)
	{
		foreach(j;0..21)
		{
			cost[i][j] = 100000;
		}
	}

	n = readln.chomp.to!int;
	m = readln.chomp.to!int;

	foreach(i;0..m)
	{
		string[] s = readln.chomp.split(",");
		int a = s[0].to!int;
		int b = s[1].to!int;
		int c = s[2].to!int;
		int d = s[3].to!int;
		cost[a][b] = c;
		cost[b][a] = d;
	}

	foreach(k;1..n+1)
	{
		foreach(i;1..n+1)
		{
			foreach(j;1..n+1)
			{
				cost[i][j] = min(cost[i][j],cost[i][k]+cost[k][j]);
			}
		}
	}

	string[] s = readln.chomp.split(",");
	int x1 = s[0].to!int;
	int x2 = s[1].to!int;
	int y1 = s[2].to!int;
	int y2 = s[3].to!int;
	int ans = y1 - y2;
	ans -= cost[x1][x2] + cost[x2][x1];
	ans.writeln;
	return 0;
}