#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;

#define MAX_N 30

int N, M, A, B, C, D, x1, x2, t1, y2;
int K[32][32];
const int inf = 100010010;

void init()
{
	for(int y=1; y<=N; ++y)
	{
		for(int x=1; x<=N; ++x)
		{
			K[x][y] = inf;
		}
	}
}

void show()
{
	for(int x=1; x<=N; ++x)
	{
		for(int y=1; y<=N; ++y)
		{
			if(K[x][y] == inf){cout << "inf ";}
			else{printf("%3d ",K[x][y]);}
		}
		cout << endl;
	}
}

void floyd_warshall()
{
	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];
				}
			}
		}
	}
}

int main()
{
	scanf("%d%d", &N, &M);
	//cout << N << " " << M << endl;
	
	init();
	
	for(int i=0; i<M; ++i)
	{
		scanf("%d,%d,%d,%d",&A, &B, &C, &D);
		//cout << " " << A << " " << B << " " << C << " " << D << endl;
		K[A][B] = C;
		K[B][A] = D;
	}
	
	scanf("%d,%d,%d,%d",&x1, &x2, &t1, &y2);
	//cout << " " << x1 << " " << x2 << " " << t1 << " " << y2 << endl;
	
	//show();
	floyd_warshall();
	//show();
	
	cout << t1 - y2 - K[x1][x2] - K[x2][x1] << endl;
}