#include <iostream>
#include <cstdio>
using namespace std;
const int INF = 100000000;

int K[25][25];

void init()
{
	for (int i = 0; i < 25; ++i)
	{
		for (int j = 0; j < 25; ++j)
		{
			K[i][j] = INF;
		}
	}
}

void show(int N)
{
	for (int i = 1; i <= N; ++i)
	{
		for (int j = 1; j <= N; ++j)
		{
			if (K[i][j] == INF)
			{
				cout << "INF" << " ";
			}
			else
			{
				cout << K[i][j] << " ";
			}
		}
		cout << endl;
	}
	cout << endl;
}

int main()
{
	init();
	int N,M,A,B,C,D,S,G,V,P;
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; ++i)
	{
		scanf("%d,%d,%d,%d", &A, &B, &C, &D);
		//cerr << "read " << A << " " << B << " " << C << " " << D << endl;
		K[A][B] = C;
		K[B][A] = D;
	}
	scanf("%d,%d,%d,%d", &S, &G, &V, &P);

	//show(N);

	for (int k = 1; k <= N; ++k)
	{
		for (int i = 1; i <= N; ++i)
		{
			for (int j = 1; j <= N; ++j)
			{
				if (K[i][j] > K[i][k] + K[k][j])
				{
					K[i][j] = K[i][k] + K[k][j];
				}
			}
		}

		//show(N);
	}

	cout << V - P - K[S][G] -K[G][S] << endl;

	return 0;
}
