#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define MAX_V  21;

struct edge{ int to, cost; };
typedef pair<int , int> P;


int V;

int INF = 10000000;
vector<edge> G[22];
int d[22];
int m;
int a1,b1,c1,d1;

bool operator < (P a,P b){
	return a.first == b.first;
}
bool comp(P a,P b){
	return a.first < b.first;
}


void dijkstra(int s){
	priority_queue<P,vector<P>,greater<P> > que;
	fill(d,d+V+1, INF);
	d[s] = 0;
	que.push(P(0,s));
	
	while (!que.empty()){
		P p = que.top(); que.pop();
		int v = p.second;
		//cout<<" que top "<<v<<endl;
		if (d[v] < p.first) continue;
		for(int i=0;i<G[v].size();i++){
			edge e = G[v][i];
			if(d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				//cout<<e.to<< " "<<d[e.to]<<endl;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main(){
	char t;
	int go,come;
	cin>>V>>m;
	rep(i,m){
		edge tmp;
		cin>>a1>>t>>b1>>t>>c1>>t>>d1;
		//cout<<a1<<endl;
		tmp.to = b1; tmp.cost = c1;
		G[a1].push_back(tmp);
		tmp.to = a1; tmp.cost = d1;
		G[b1].push_back(tmp);
	}
	/*
	rep(i,V+1){
		rep(j,G[i].size()){
			cout<<i<< " "<<G[i][j].to<< " "<<G[i][j].cost<<endl;
		}
	}
	*/
	cin>>a1>>t>>b1>>t>>c1>>t>>d1;
	dijkstra(a1);
	go = d[b1];
	
	//cout<<"go  d[i]\n";
	rep(i,V+1){
		//cout<<i<<" "<<d[i]<<endl;
	}
	
	//cout<<"go = "<< go<< endl;
	dijkstra(b1);
	come = d[a1];
	//cout << "come = " << come<< endl;
	cout<<c1-d1-go-come<<endl;
	return 0;
}