#include<cstdio>
#include<algorithm>
using namespace std;
#define INF 1000000
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	
	int D[32][32]={{0}};/*Adjacency matrix*/
	
	for(int i = 0; i < m; i++){
		int a,b,c,d;
		scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		D[a-1][b-1] = c;
		D[b-1][a-1] = d;
	}
	int ans = 0;
	int go,back,y1,y2;
	scanf("%d,%d,%d,%d",&go,&back,&y1,&y2);
	ans = y1-y2;
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(i == j)continue;
			if(D[i][j] == 0)D[i][j] = INF;
		}
	}
	
	int cost = 0;
	for(int k = 0; k < n; k++){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				D[i][j] = min(D[i][j],D[i][k]+D[k][j]);
			}
		}
	}
	cost = D[go-1][back-1] + D[back-1][go-1];
	
	printf("%d\n",ans-cost);
	return 0;
}