#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(s) (s).begin(),(s).end()

#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(a,b) make_pair((a),(b))

#define INF 999999
#define MAX_V 999

using namespace std;

struct Node{
	int cost;
	int depart;
	int arrival;
};

vector<Node> dat;
vector<int> cost;

void dijkstra(int s){
	int pos;
	queue<int> q;
	int t;
	cost.at(s)=0;
	
	for(vector<Node>::iterator i=dat.begin();i!=dat.end();i++){
		if((*i).depart==s){
			q.push((*i).arrival);
			cost.at((*i).arrival)=(*i).cost;
		}
	}
	
	while(!q.empty()){
		
		pos=q.front();
		q.pop();
		
		for(vector<Node>::iterator i=dat.begin();i!=dat.end();i++){
			if((*i).depart==pos){
				if(cost.at((*i).arrival)==INF){
					q.push((*i).arrival);
				}
				if(cost.at((*i).arrival)>(*i).cost+cost.at(pos)){
					cost.at((*i).arrival)=(*i).cost+cost.at(pos);
				}
			}
		}
		bool f=true;
		for(int i=0;i<cost.size();i++){
			if(cost.at(i)==INF){
				f=false;
			}
		}
		if(f){
			break;
		}
	}
}

int main(){
	int a, b, c, d, x1, x2, y1, y2;
	Node t;
	int n, m;
	cin>>n>>m;
	rep(i,m){
		scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		t.depart =a;
		t.cost   =c;
		t.arrival=b;
		dat.push_back(t);
		t.depart =b;
		t.cost   =d;
		t.arrival=a;
		dat.push_back(t);
	}
	scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
	cost.clear();
	FOR(k,0,n+1){
		cost.push_back(INF);
	}
	dijkstra(x1);
	int Cost=cost.at(x2);
	cost.clear();
	for(int i=0;i<n+1;i++){
		cost.push_back(INF);
	}
	dijkstra(x2);
	cout<<y1-(y2+Cost+cost.at(x1))<<endl;
	return 0;
}