#include <stdio.h>
#define INF 200000000

int n,m;
int a,b,c,d;
int s,g,V,P;

int mat[21][21];

int main(){
	//init
	for(int i = 0; i < 21; i++){
		for(int j = 0; j < 21; j++){
			mat[i][j] = INF;
			if(i == j)
				mat[i][j] = 0;
		}
	}
	//input
	scanf("%d%d",&n,&m);
	for(int i = 1; i <= m; i++){
		scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		mat[a][b] = c;
		mat[b][a] = d;
	}
	scanf("%d,%d,%d,%d",&s,&g,&V,&P);
	//update mat
	for(int k = 1; k <= n; k++){
		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= n; j++){
				int r = mat[i][k] + mat[k][j];
				mat[i][j] = mat[i][j] > r ? r : mat[i][j];
			}
		}
	}
	//output
	printf("%d\n", V - P - mat[s][g] - mat[g][s]);

	return 0;
}

