#include <iostream>
#include <queue>
using namespace std;
#define NMAX 22
bool visited[NMAX];
int n,m,x1,x2,y1,y2;
int dist[NMAX][NMAX];
class Node{
public:
	int p,cost;
	Node(int _p, int _cost):p(_p),cost(_cost){
	}
	bool operator < (const Node &o)const{
		return cost>o.cost;
	}
};
int dijkstra(int from,int to){
	fill(visited,visited+NMAX,false);
	priority_queue<Node> pq;
	pq.push(Node(from,0));
	while(!pq.empty()){
		Node cur=pq.top();pq.pop();
		if(cur.p==to)return cur.cost;
		if(visited[cur.p])continue;
		visited[cur.p]=true;
		for(int i=1;i<=n;i++){
			if(cur.p==i||dist[cur.p][i]==-1)continue;
			pq.push(Node(i,cur.cost+dist[cur.p][i]));			
		}
	}
}
void solve(){
	cout<<y1-y2-dijkstra(x1,x2)-dijkstra(x2,x1)<<endl;
}
void init(){
	for(int i=0;i<=NMAX;i++)fill(dist[i],dist[i]+NMAX,-1);	
}
int main(){
	int a,b,c,d;
	cin>>n>>m;
	char dmy;
	init();
	for(int i=0;i<m;i++){
		cin>>a>>dmy>>b>>dmy>>c>>dmy>>d;
		dist[a][b]=c;
		dist[b][a]=d;
	}
	cin>>x1>>dmy>>x2>>dmy>>y1>>dmy>>y2;
	solve();
}