//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a);i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)

//clear memory
//--------------------------------------------
#define CLR(a) memset((a), 0 , sizeof(a))


#define MAXVTX 21
int n, m, x[2], y[2];
int amat[21][21];
int vtx[21];
int res = 0;
char cht;
queue<int> qu;

int djk(int start, int goal)
{
	FOR(i,0,MAXVTX)
		vtx[i] = INT_MAX;
	
	qu.push(start);
	vtx[start] = 0;
	
	while( !qu.empty() )
	{
		int a = qu.front();
		qu.pop();
		
		FOR(i,0,MAXVTX)
		{
			if( a != i && amat[a][i] > 0 && (amat[a][i] + vtx[a] < vtx[i] ) )
			{
				qu.push(i);
				vtx[i] = amat[a][i] + vtx[a];
			}
		}
	}
	
	return vtx[goal];
}

int main()
{
	CLR(amat);
	
	cin >> n >> m;

	FOR(i,0,m)
	{
		int a, b, c, d;
		
		cin >> a >>cht>> b >>cht>> c >>cht>> d;
		
		
		amat[a][b] = c;
		amat[b][a] = d;
	}
	
	cin >> x[0] >>cht>> x[1] >>cht>> y[0] >>cht>> y[1];
	
	
	res = y[0] - y[1] -djk(x[0], x[1]) -djk(x[1], x[0]);
	cout << res << endl;
	
	return 0;
}