#include<iostream>
#include<queue>
#include<cstdio>

#define inf 1000000000

using namespace std;

class sint{
	public:
	int iti,now;
	sint(){}
	sint(int a,int b){iti=a;now=b;}
	bool operator < (const sint &a) const{
		return now>a.now;
	}
};

int n,m;
int road[21][21];
int dike(int st,int en){
	priority_queue<sint> state;
	int sima[101];
	int visit[101];
	
	for(int i=0;i<101;i++){
		sima[i]=inf;
		visit[i]=0;
	}
	
	state.push(sint(st,0));
	sima[st]=0;
	
	while(1){
		sint u = state.top();
		state.pop();
		/*
		for(int i=1;i<=n;i++){
			printf("%d ",sima[i]);
		}puts("");
		
		printf("now = %d en = %d\n",u.iti,en);
		*/visit[u.iti]=1;
		
		if(u.iti==en){
			return u.now;
		}
		
		for(int i=1;i<=n;i++){
			if(road[u.iti][i]==inf||visit[i]==1)continue;
			if(sima[u.iti]+road[u.iti][i]<sima[i]){
				sima[i]=sima[u.iti]+road[u.iti][i];
				state.push(sint(i,sima[i]));
			}
		}
	}
}

int main(){
	cin>>n>>m;
	for(int i=0;i<21;i++){
		for(int j=0;j<21;j++){
			road[i][j]=inf;
		}
	}
	
	for(int i=0;i<m;i++){
		int a,b,c,d;
		scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		road[a][b]=c;
		road[b][a]=d;
	}
	
	int st,en,d1,d2;
	scanf("%d,%d,%d,%d",&st,&en,&d1,&d2);
	
	int gou = dike(st,en);
	gou+=dike(en,st);
	
	printf("%d\n",d1-d2-gou);
}