#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
using namespace std;

/*
const int MAX_E=2*(100-1);
const int MAX_V=100;
const long long int INF=100000000;
struct edge { int from,to,cost;};
edge es[MAX_E];
//int d[MAX_V];
int V,E;
void shortest_path(int s,int e,vector<int>& d);
int main(){
	int n,k;
	while(cin >> n >> k&&n!=0&&k!=0){
		int V=n;
		int E=2*(n-1);
		vector<int> land(V);
		int l=0;
		for(int i=0; i<E; ++i){
			es[i].cost=-1;
			es[i].from=-1;
			es[i].to=-1;
		}
		for(int i=0; i<k; ++k){
			int m;
			cin >> m;
			if(m==0){
				int a,b;
				cin >> a >> b;
				shortest_path(a,b,land);
				cout << land[b] << "\n";
			} else if(m==1){
				int c,d,e;
				cin >> c >> d >> e;
				es[l].from=c;
				es[l].to=d;
				es[l].cost=e;
				es[l+1].from=d;
				es[l+1].to=c;
				es[l+1].cost=e;
				l+=2;
			}
		}
	}
	return 0;
}
*/
void func(string str,vector<int>& a);
const int INF=10000000;
int main(){
	int n,m;
	cin >> n >> m;
	vector< vector<int> > wf(n+1,vector<int>(n+1));
	for(int i=1; i<n+1; ++i){
		for(int j=1; j<n+1; ++j){
			wf[i][j]=INF;
		}
	}
	for(int i=1; i<n+1; ++i){
		for(int j=1; j<n+1; ++j){
			if(i==j)wf[i][j]=0;
		}
	}
	for(int i=0; i<m; ++i){
		string str;
		vector<int> abcd(4);
		cin >> str;
		func(str,abcd);
		wf[abcd[0]][abcd[1]]=abcd[2];
		wf[abcd[1]][abcd[0]]=abcd[3];
	}
	vector<int> xy(4);
	string hoge;
	cin >> hoge;
	func(hoge,xy);
	for(int i=1; i<n+1; ++i){
		for(int j=1; j<n+1; ++j){
			for(int k=1; k<n+1; ++k){
				wf[j][k]=min(wf[j][k],wf[j][i]+wf[i][k]);
			}
		}
	}
	//cout << xy[2] << " " << xy[3] << " " << wf[xy[0]][xy[1]] << " " << wf[xy[1]][xy[0]] << "\n";
	cout << xy[2]-xy[3]-wf[xy[0]][xy[1]]-wf[xy[1]][xy[0]] << "\n";
	return 0;
}

void func(string str,vector<int>& a){
	int n;
	n=str.size();
	int j=0;
	string tmp;
	for(int i=0; i<n; ++i){
		if(i==n-1){
			tmp+=str[i];
			a[j]=atoi(tmp.c_str());
		} else {
			if(str[i] != ','&&i!=n-1) {
				tmp+=str[i];
			} else{
				a[j]=atoi(tmp.c_str());
				++j;
				tmp="";
			}
		}
	}
}