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

constexpr int INF = 1 << 20;

class Graph {
private:
	const int N;
	vector<int> edge;
public:
	Graph(int n) : N(n), edge(n*n, INF) {}
	void InputEdge(int a, int b, int c, int d) {
		edge[(a - 1) * N + b - 1] = c;
		edge[(b - 1) * N + a - 1] = d;
	}
	void Show() {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				int e = edge[i * N + j];
				if (e == INF)
					cout << "Inf" << "\t";
				else
					cout << e << "\t";
			}
			cout << endl;
		}
	}
	int FWSearch(int s, int g);
};

int Graph::FWSearch(int s, int g) {
	for (int k = 0; k < N; k++)
		for (int i = 0; i < N; i++)
			for (int j = 0; j < N; j++)
				if (edge[i * N + j] > edge[i * N + k] + edge[k * N + j])
					edge[i * N + j] = edge[i * N + k] + edge[k * N + j];
	return edge[(s - 1) * N + g - 1];
}

int main() {
	int n, m;
	cin >> n >> m;
	Graph G(n);
	for (int i = 0; i < m; i++) {
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		G.InputEdge(a, b, c, d);
	}
	int s, g, V, P;
	scanf("%d,%d,%d,%d", &s, &g, &V, &P);
	int C[2] = { G.FWSearch(s, g), G.FWSearch(g, s) };
	cout << V - P - C[0] - C[1] << endl;
}
