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

#define NONE INT_MAX>>2

struct Data{int id,cost;};
bool operator<(Data a,Data b){return a.cost!=b.cost?a.cost<=b.cost:a.id<=b.id;}

int n,m,a,b,c,d,x1,x2,y1,y2;
vector< vector<int> >D;

int Dijkstra(int start,int goal)
{
  vector<int>l(n,NONE),visited(n,0);
  priority_queue<Data>q;
  int u;
  Data d={start,0};
  q.push(d);
  l[start]=0;
  while(q.size()){
    u=q.top().id;q.pop();
    visited[u]=1;
    for(int v=0;v<n;v++){
      if(visited[v])continue;
      if(l[u]+D[u][v] >= l[v])continue;
      l[v]=l[u]+D[u][v];
      Data d={v,l[v]};
      q.push(d);
    }
  }
  return l[goal];
}

int main()
{
  cin>>n>>m;
  D.resize(n);
  for(int i=0;i<n;i++)D[i].resize(n,NONE);
  while(m-->0){
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    a--;
    b--;
    D[a][b]=c;
    D[b][a]=d;
  }
  scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
  x1--;x2--;
  cout<<(y1-y2-Dijkstra(x1,x2)-Dijkstra(x2,x1))<<endl;
}