#include<iostream>
#include<stdio.h>
using namespace std;

const int NUM = 25;

int main() {
	int wf[NUM][NUM];
	
	for ( int i = 0; i < NUM; i++ ) {
		for ( int j = 0; j < NUM; j++ ) {
			if ( i == j ) {
				wf[i][j] = 0;
			} else {
				wf[i][j] = 100000;
			}
		}
	}
	
	int n,m;
	cin >> n >> m;
	for ( int i = 0; i < m; i++ ) {
		int a,b,c,d;
		scanf ( "%d,%d,%d,%d",&a,&b,&c,&d );
		a--;b--;
		wf[a][b] = c;
		wf[b][a] = d;
	}
	
	for ( int a = 0; a < n; a++ ) {
		for ( int b = 0; b < n; b++ ) {
			for ( int c = 0; c < n; c++ ) {
				wf[b][c] = min ( wf[b][c] , wf[b][a] + wf[a][c] );
			}
		}
	}
	int x1,x2,y1,y2;
	scanf ( "%d,%d,%d,%d",&x1,&x2,&y1,&y2 );
	x1--;x2--;
	int cost = wf[x1][x2] + wf[x2][x1];
	cout << y1 - ( y2 + cost ) << endl;
}