#include <iostream>
#include <cstdio>
#include <queue>
#include <utility>
using namespace std;

int n;
vector<int> edge[101];
vector<int> weight[101];

int v[100];
int M = 1001001001;


int dijkstra(int a){
	for(int i=0; i<100; i++){
		v[i] = M;
	}
	priority_queue<pair<int, int> > pq;
	pq.push(pair<int,int>(0, a));

	while(!pq.empty()){
		pair<int, int> t = pq.top();
		pq.pop();
		if(v[t.second]!=M) continue;

		v[t.second] = -t.first;
		for(int i=0; i<edge[t.second].size(); i++){
			pq.push(pair<int, int>(t.first-weight[t.second][i], edge[t.second][i]));
		}
	}


}

int main(){
	int m;
	cin >> n >> m;
/*
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			dst[i][j] = M;
		}
	}
	*/

	for(int i=0; i<m; i++){
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		edge[a-1].push_back(b-1);
		weight[a-1].push_back(c);
		edge[b-1].push_back(a-1);
		weight[b-1].push_back(d);
	}
	int x1, x2, y1, y2;
	scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
	int ans = 0;
	dijkstra(x1-1);
	ans += v[x2-1];
	dijkstra(x2-1);
	ans += v[x1-1];
	cout << y1 - y2 - ans << endl;
	return 0;
}