#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
	int n, m, reward;
	int a, b, c, d;
	int x1, x2, y1, y2;
	int cost[21][21];
	char ch;

	cin >> n >> m;

	for (int i = 0; i < 21; i++)
	{
		for (int j = 0; j < 21; j++)
		{
			cost[i][j] = 10000;			//????°?????????¨?????????????????????cost>1000
		}
	}

	for (int i = 0; i < m; i++)
	{
		cin >> a >> ch >> b >> ch >> c >> ch >> d;
		cost[a][b] = c;
		cost[b][a] = d;
	}
	cin >> x1 >> ch >> x2 >> ch >> y1 >> ch >> y2;

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			for (int k = 1; k <= n; k++)
			{
				cost[j][k] = min(cost[j][k], cost[j][i] + cost[i][k]);		//???????????£??????????????????????????£?????????????????????????????????
			}
		}
	}
	reward = y1 - y2 - cost[x1][x2] - cost[x2][x1];
	
	cout << reward << endl;

	return 0;
}