#include<iostream>
#include<queue>
using namespace std;

class Node{
public:
	int node;
	int cost;
	Node(int n,int c){
		node = n;
		cost = c;
	}
	bool operator < (const Node &o) const{
		return cost > o.cost;
	}
};
#define MAX 2000000000
int main(){
	int n,m;
	int s,g,money,hashira;
	priority_queue<Node> pq;
	priority_queue<Node> pq2;
	int map[50][50];
	bool visited[100];
	char ch;

	cin >> n >> m;
	for(int i = 1; i <=n;i++ ){
		visited[i] = false;
	}
	for(int i = 1 ; i <=n ;i++){
		for(int j = 1;j <=n ;j++){
			map[i][j] = MAX;
		}
	}

	for(int i = 1 ; i <= m;i++){
		int a,b,c,d;
		cin >> a >> ch >> b >> ch >> c >> ch >> d;
		map[a][b] = c;
		map[b][a] = d;
	}

	cin >> s >> g >> money >> hashira;
	//ツ行ツつォツづ個コツスツトツづーツ仰づ淞づゥ
	pq.push(Node(s,0));
	while(!pq.empty()){
		Node c_node = pq.top();
		pq.pop();
		if(c_node.node == g){
			pq2.push(c_node);
			break;
		}
		if(visited[c_node.node])continue;
		visited[c_node.node]= true;
		for(int i = 1;i <= n;i++ ){
			if(map[c_node.node][i] == MAX)continue;
			int n_cost = c_node.cost + map[c_node.node][i];
			pq.push(Node(i,n_cost));
		}
	}

	for(int i = 1; i <= n;i++ ){
		visited[i] = false;
	}

	//ツ帰ツづィツづ個コツスツトツづーツ仰づ淞づゥ
	while(!pq2.empty()){
		Node c_node = pq2.top();
		pq2.pop();
		if(c_node.node == s){
			int ans = money - hashira-c_node.cost;
			cout <<ans <<endl;
			break;
		}
		if(visited[c_node.node])continue;
		visited[c_node.node]= true;
		for(int i = 1;i <= n;i++ ){
			if(map[c_node.node][i] == MAX)continue;
			int n_cost = c_node.cost + map[c_node.node][i];
			pq2.push(Node(i,n_cost));
		}
	}
	return 0;
}