#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

vector<ll>Dijkstra(const vector<vector<pair<ll, ll>>>&edge, ll start = 0)
{
	vector<ll>dist(edge.size(), INFLL); dist[start] = 0;
	priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> node_queue;
	node_queue.push(make_pair(0, start));
	while (!node_queue.empty()) {
		ll tpn_cost = node_queue.top().first, tpn_index = node_queue.top().second; node_queue.pop();
		for (auto i : edge[tpn_index]) {
			ll dst_cost = i.first, dst_index = i.second;
			if (dist[dst_index] > tpn_cost + dst_cost) {
				dist[dst_index] = tpn_cost + dst_cost;
				node_queue.push(make_pair(dist[dst_index], dst_index));
			}
		}
	}
	return dist;
}
signed main()
{
	ll n = in(), m = in();
	vector<vector<pair<ll, ll>>>edge(n);
	REP(i, m) {
		ll a, b, c, d;
		scanf("%lld,%lld,%lld,%lld", &a, &b, &c, &d);
		--a, --b;
		edge[a].push_back(make_pair(c, b));
		edge[b].push_back(make_pair(d, a));
	}
	ll s, g, v, p;
	scanf("%lld,%lld,%lld,%lld", &s, &g, &v, &p);
	--s, --g;
	auto dist1(move(Dijkstra(edge, s))), dist2(move(Dijkstra(edge, g)));
	cout << v - dist1[g] - p - dist2[s] << endl;
}
