#include<bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;i++)
#define MAX 200000000
using namespace std;
int main(void)
{
	int n,m;
	int a,b,c,di;
	int s,g,v,p;
	int d[21][21];
	char ch;
	cin>>n>>m;
	rep(i,n)rep(j,n)d[i][j]=(i==j)?0:MAX;
	rep(i,m){
		cin>>a>>ch>>b>>ch>>c>>ch>>di;
		d[a][b]=c;
		d[b][a]=di;
	}
	rep(k,n)rep(i,n)rep(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	cin>>s>>ch>>g>>ch>>v>>ch>>p;
	cout<<v-p-d[s][g]-d[g][s]<<endl;
	return 0;
}
