#include<cstdio>
#include<algorithm>
using namespace std;
#define INF 1000000
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	
	int D[32][32][2]={{{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][0] = c;
		D[b-1][a-1][0] = c;
		D[a-1][b-1][1] = d;
		D[b-1][a-1][1] = d;
	}
	int ans = 0;
	int x1,x2,y1,y2;
	scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
	ans = y1-y2;
	for(int k = 0; k < 2; k++){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(i == j)continue;
				if(D[i][j][k] == 0)D[i][j][k] = INF;
			}
		}
	}
	int cost = 0;
	for(int l = 0; l < 2; l++){
		for(int k = 0; k < n; ++k){
			for(int i = 0; i < n; ++i){
				for(int j = 0; j < n; ++j){
					D[i][j][l] = min(D[i][j][l],D[i][k][l]+D[k][j][l]);
				}
			}
		}
		(l == 0) ? cost += D[x1-1][x2-1][0] : cost += D[x2-1][x1-1][1];
	}
	printf("%d\n",ans-cost);
	return 0;
}