#include <iostream>	
#include <vector>
#include <climits>
#include <cstdio>

struct Edge {
	int s;
	int t;
	int c;
	Edge() {}
	Edge(int s, int t, int c) : s(s), t(t), c(c) {}
};
bool operator < (const Edge& e, const Edge& f) { return e.c < f.c; }


int main()
{
	int n, m;
	std::cin >> n >> m;
	//std::cout << n << " " << m << std::endl;
	std::vector<Edge> edge_list;
	
	for (int i=0; i<m; i++) {
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		//std::cout << a << " " << b << " " << c << " " << d <<std::endl;
		edge_list.push_back( Edge(a,b,c) );
		edge_list.push_back( Edge(b,a,d) );
	}
	
	int* distance = new int[n+1];
	
	int S, G, V, P;
	scanf("%d,%d,%d,%d", &S, &G, &V, &P);
	
	int res = 0;
	
	//std::cout << S << " " << G << std::endl;
	
	for (int i=1; i<=n; i++) distance[i] = INT_MAX;
	distance[S] = 0;
	for (int i=0; i<n; i++) {
		for (int j=0; j<2*m; j++) {
			int s = edge_list[j].s;
			int t = edge_list[j].t;
			int c = edge_list[j].c;
			if (distance[s] < distance[t] - c) distance[t] = distance[s] + c;
		}
	}
	res += distance[G];
	
	//for (int i=1; i<=n; i++) {
	//	std::cout << i << " : " << distance[i] << std::endl;
	//}
	
	for (int i=1; i<=n; i++) distance[i] = INT_MAX;
	distance[G]  = 0;
	for (int i=0; i<n-1; i++) {
		for (int j=0; j<2*m; j++) {
			int s = edge_list[j].s;
			int t = edge_list[j].t;
			int c = edge_list[j].c;
			if (distance[s] < distance[t] - c) distance[t] = distance[s] + c;
		}
	}
	res += distance[S];
	
	std::cout << V - P - res << std::endl;
	
	delete[] distance;
	
	return 0;
}
	

