#include <cstdio>
#include <iostream>
#include <queue>
#define INF (1<<21)
using namespace std;

class State{
public:
  int n,cost,f;
  State(int n = 0,int cost = 0,int f = 0):n(n),cost(cost),f(f){}
  bool operator < (const State &s) const{ return cost > s.cost;}
};

int main(){
  int i,j,n,m,a,b,c,e,x1,x2,ans,y2,G[21][21];
  State d[21];
  priority_queue<State> PQ;
  cin >> n >> m;
  for(i=0;i<=n;i++){
    for(j=0;j<=n;j++) G[i][j] = INF;
	d[i].cost = INF;
	d[i].n = i;
	d[i].f = 0;
  }

  for(i=0;i<m;i++){
    scanf("%d,%d,%d,%d",&a,&b,&c,&e);
    G[a][b] = c;
    G[b][a] = e;
  }
  scanf("%d,%d,%d,%d",&x1,&x2,&ans,&y2);
  ans -= y2;

  d[x1].cost = 0;
  State p = d[x1];
  PQ.push(p);
  while(!PQ.empty()){
    p = PQ.top();
    PQ.pop();
    d[p.n].f = 1;
    
    for(i=0;i<=n;i++){
      if(d[i].f == 0 && G[p.n][i] + p.cost < d[i].cost){
	d[i].cost = G[p.n][i] + p.cost;
	PQ.push(d[i]);
      }
    }
  }
  ans -= d[x2].cost;
  
  for(i=0;i<=n;i++){
    d[i].cost = INF;
    d[i].n = i;
    d[i].f = 0;
  }
  
  d[x2].cost = 0;
  p = d[x2];
  PQ.push(p);
  while(!PQ.empty()){
    p = PQ.top();
    PQ.pop();
    d[p.n].f = 1;
    
    for(i=0;i<=n;i++){
      if(d[i].f == 0 && G[p.n][i] + p.cost < d[i].cost){
	d[i].cost = G[p.n][i] + p.cost;
	PQ.push(d[i]);
      }
    }
  }
  ans -= d[x1].cost;
  
  cout << ans << endl;
  
  return 0;
}