#include<algorithm>
#include<iostream>
#include<cstdio>

const int INF = 1001;

int n, m;
int dist[20][20];
int s, e, x, y;

int main()
{
	for( int i = 0; i != 20; ++i )
		for( int j = 0; j != 20; ++j )
				dist[i][j] = i == j ? 0 : INF;

	std::cin >> n >> m;
	
	for( int i = 0; i != m; ++i )
	{
		int a, b, c, d;
		scanf( "%d,%d,%d,%d", &a, &b, &c, &d );
		dist[a-1][b-1] = c;
		dist[b-1][a-1] = d;
	}

	scanf( "%d,%d,%d,%d", &s, &e, &x, &y );

	for( int k = 0; k != n; ++k )
		for( int i = 0; i != n; ++i )
			for( int j = 0; j != n; ++j )
				dist[i][j] = std::min( dist[i][j], dist[i][k] + dist[k][j] );

	std::cout << x - y - dist[s-1][e-1] - dist[e-1][s-1] << std::endl;

	return 0;
}