#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;
typedef vector<ll> V;

struct edge{
	ll to;
	ll cost;
	edge(ll to, ll cost) :to(to), cost(cost){};
};

vector<edge> G[100];
ll n, m;
ll a, b, c, d;
char k;
ll sum[100];
ll iki, kaeri;

void djikstra(int start){
	REP(i, 100){
		sum[i] = INF;
	}
	sum[start] = 0;

	priority_queue<P> que;//fi:cost,se:vertex
	que.push(P(0, start));

	while (que.size()){
		P p = que.top(); que.pop();
		int v = p.second;

		if (sum[v] < p.first)continue;
		for (int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if (sum[e.to] > sum[v] + e.cost){
				sum[e.to] = sum[v] + e.cost;
				que.push(P(sum[e.to], e.to));
			}
		}
	}
}

int main(){
	cin >> n >> m;
	REP(i, m){
		cin >> a >> k >> b >> k >> c >> k >> d;
		G[a].push_back(edge(b, c));
		G[b].push_back(edge(a, d));
	}
	cin >> a >> k >> b >> k >> c >> k >> d;
	djikstra(a);
	iki = sum[b];
	djikstra(b);
	kaeri = sum[a];
	cout << c - d - iki - kaeri << endl;
}