#include<iostream>
using namespace std;

int main()
{
  int n;
  for(;cin>>n;)
    {
      int edge[n][n],m;
      cin>>m;
	for(int i=0;i<n;i++)
	  for(int j=0;j<n;j++)
	    {
	      if(i==j)
		edge[i][j]=0;
	      else
		edge[i][j]=1000000;
	    }
      for(int i=0;i<m;i++)
	{
	  char ch;
	  int a,b,c,d;
	  cin>>a>>ch>>b>>ch>>c>>ch>>d;
	  a--;b--;
	  edge[a][b]=c;
	  edge[b][a]=d;
	}
      for(int k=0;k<n;k++)
	for(int i=0;i<n;i++)
	  for(int j=0;j<n;j++)
	    edge[i][j]=min(edge[i][j],edge[i][k]+edge[k][j]);
      /*   
      for(int i=0;i<n;i++,cout<<endl)
	  for(int j=0;j<n;j++)
	    cout<<edge[i][j]<<" ";
      */
      int a,b,c,d;
      char ch;
      cin>>a>>ch>>b>>ch>>c>>ch>>d;
      a--;b--;
      cout<<c-d-edge[a][b]-edge[b][a]<<endl;
      
    }
}