#include<iostream>
#include<vector>
#include<queue>
#include<cstdio>

using namespace std;

#define N_MAX 20
#define M_MAX 100
#define INF 10000

struct Edge{

  Edge(int t,int c)
    :to_(t),cost_(c) {};

  int to_;
  int cost_;

};

vector<int> d(N_MAX);
vector<Edge> edge[M_MAX];

int s,g,V,P;

int dijkstra(int start,int goal){
  typedef pair<int,int> PII;
  priority_queue<PII,vector<PII>,greater<PII>> que;

  fill(d.begin(),d.end(),INF);
  d[start]=0;
  que.push(PII(start,0));

  while(!que.empty()){
    PII p=que.top();
    que.pop();
    int v=p.first;

    if(d[v]<p.second) continue;

    for(int i=0;i<edge[v].size();++i){
      Edge e=edge[v][i];
      if(d[e.to_]>d[v]+e.cost_){
	d[e.to_]=d[v]+e.cost_;
	que.push(PII(e.to_,d[e.to_]));
      }
    }
  }
  return d[goal];
}

int main(){
  int n,m,a,b,c,d;
  cin>>n;
  cin>>m;

  for(int i=0;i<m;++i){
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    edge[a].push_back(Edge(b,c));
    edge[b].push_back(Edge(a,d));
  }

  scanf("%d,%d,%d,%d",&s,&g,&V,&P);

  V-=dijkstra(s,g);
  V-=dijkstra(g,s);

  cout<<V-P<<endl;

}