#if 0
????????£????????????35m
Floyd-Warshall????????£?????¨??????????????????????±??????????
???????????????????????????????????????????°?????????????
#endif


#include <iostream>
#include <cstdio>
using namespace std;

int N, M, A, B, C, D, x1, x2, y1, y2;
int K[32][32];
const int inf=1001001001;

int main() {
	long long pay,ans;
	for(int i=0;i<32;i++)
		for(int j=0;j<32;j++)
			K[i][j]=inf;

	scanf("%d%d", &N, &M);
	for (int i=0; i<M; ++i) {
		scanf("%d,%d,%d,%d", &A, &B, &C, &D);
		//cerr << "read " << A <<" "<< B <<" " << C <<" " << D<< endl;
		K[A][B]=C;
		K[B][A]=D;
	}
	
	for(int k=1;k<N+1;k++){
		for(int i=1;i<N+1;i++){
			for(int j=1;j<N+1;j++){
	if(K[i][j]>K[i][k]+K[k][j]){
		K[i][j]=K[i][k]+K[k][j];
	}
			}
		}
	}
	scanf("%d,%d,%d,%d", &A, &B, &C, &D);
	pay=K[A][B]+K[B][A];
	ans=C-D-pay;
	cout<<ans<<endl; 
}
#if 0
??£??\???????¨????????????§???
Inf  2   4   4  Inf Inf 
 2  Inf Inf Inf  3  Inf 
 3  Inf Inf  4  Inf  1  
 2  Inf  2  Inf Inf  1  
Inf  2  Inf Inf Inf  1  
Inf Inf  2   1   2  Inf 
Inf  2   4   4  Inf Inf 
 2   4   6   6   3  Inf 
 3   5   7   4  Inf  1  
 2   4   2   6  Inf  1  
Inf  2  Inf Inf Inf  1  
Inf Inf  2   1   2  Inf 
??¨?????????????????????
???????????????
4   2   4   4   5   5  
 2   4   6   5   3   4  
 3   5   3   2   3   1  
 2   4   2   2   3   1  
 4   2   3   2   3   1  
 3   4   2   1   2   2
 ?????§????????????????¢??????§?????????
#endif