#include <iostream>
#include <climits>
#include <string>
class City;
struct Path {
	int cost;
	City *to;
};
class City {
public:
	City() {};
	void add_path(const Path &path) {
		route[idx++] = path;
	}
	int cost{ INT_MAX };
	void go_next() {
		reach_flag = true;
		for (auto i = 0; i < idx; ++i) {
			route[i].to->arrive_at(cost + route[i].cost);
		}
	}
	bool is_reached() const { return reach_flag; };
	void reset() { reach_flag = false; cost = INT_MAX; }
private:
	int idx{ 0 };
	Path route[20];
	bool reach_flag{ false };
	void arrive_at(const int &c) {
		if (c < cost) cost = c;
	}
};
void read_sub(std::string &str, int &a) {
	auto idx = str.find(',');
	a = std::stoi(str.substr(0, idx));
	str = str.substr(idx + 1);
}
void read(std::string str, int &a, int &b, int &c, int &d) {
	read_sub(str, a); read_sub(str, b); read_sub(str, c); d = std::stoi(str);
}
int cul_cost(City city[], int n, int start, int goal) {
	for (auto i = 1; i <= n; ++i) {
		city[i].reset();
	}
	city[start].cost = 0;
	auto min = start;
	while (min != goal){
		city[min].go_next();
		auto min_cost = INT_MAX;
		for (auto i = 1; i <= n; ++i) {
			if (!city[i].is_reached() && city[i].cost < min_cost) {
				min_cost = city[i].cost;
				min = i;
			}
		}
	}
	return city[goal].cost;
}
int main() {
	City city[21];
	int n;
	std::cin >> n;
	for (auto i = 1; i <= n; ++i) {
		city[i] = City();
	}
	int m;
	std::cin >> m;
	for (auto i = 0; i < m; ++i) {
		int a, b, c, d;
		std::string str;
		std::cin >> str;
		read(str, a, b, c, d);
		city[a].add_path({ c, &city[b] });
		city[b].add_path({ d, &city[a] });
	}
	int start, goal, reward, pillar_cost;
	std::string str;
	std::cin >> str;
	read(str, start, goal, reward, pillar_cost);
	auto all_cost = cul_cost(city, n, start, goal) + cul_cost(city, n, goal, start);
	std::cout << reward - pillar_cost - all_cost << std::endl;
	return 0;
}