#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int ret = INT_MAX;
int s, g;
void dfs(vector<vector<int> > vc, int cost, int v, bool f, vector<bool> &visited) {
	if(ret < cost) return;
	if(f && v == s) {
		if(ret > cost) ret = cost;
		return;
	}
	if(!f && v == g) {
		f = true;
		rep(i,visited.size()) {
			visited[i] = false;
		}
	}
	rep(i,vc[v].size()) {
		if(vc[v][i] != -1 && !visited[i]) {
			visited[i] = true;
			dfs(vc, cost+vc[v][i], i, f, visited);
			visited[i] = false;
		}
	}
}
		
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int> > vc(n); 
	rep(i,n) {
		vector<int> va(n);
		vc[i] = va;
		rep(j,n) {
			vc[i][j] = -1;
		}
	}
	rep(i,m) {
		int s, t, c1, c2;
		scanf("%d,%d,%d,%d", &s, &t, &c1, &c2);
		vc[--s][--t] = c1;
		vc[t][s] = c2;
	}
	int sum, cost;
	scanf("%d,%d,%d,%d", &s, &g, &sum, &cost);
	--s, --g;
	vector<bool> visited(n);
	rep(i,n) {
		visited[i] = false;
	}
	dfs(vc,0,s,false,visited);
	cout << sum - cost - ret << endl;
	return 0;
}