#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)

int d[22][22];
int V;
int inf=10000000;

void warshall_floyd(){
	for(int k=0; k<V; k++){
		for(int i=0;i<V;i++){
			for(int j=0;j<V;j++){
				d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
}
	

int main(){
	int n,m;
	int a,b,c,e;
	char tmp;
	
	cin>>n>>m;
	V=n;
	rep(i,n+1){
		rep(j,n+1){
			d[i][j]=inf;
		}
	}
	rep(i,n+1) d[i][i]=0;
	rep(i,m){
		cin>>a>>tmp>>b>>tmp>>c>>tmp>>e;
		//cout<<a<<endl;
		d[a-1][b-1]=c;
		d[b-1][a-1]=e;
	}
	//cout<<"hoge";
	warshall_floyd();
	cin>>a>>tmp>>b>>tmp>>c>>tmp>>e;
	cout<<c-e-d[b-1][a-1]-d[a-1][b-1]<<endl;
	return 0;
}