

#include<bits/stdc++.h>
using namespace std;

#define INF 1<<29
#define F first
#define S second;

typedef pair<int,int>P;
typedef struct{
  int cost,to;
}Edge;
int n,m;
vector<Edge>g[21];
int D[21];
int starts,goal; 

int daikusutora();

int main(){
  int a,b,c,d;
  int money,hasi;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    a--;b--;
    g[a].push_back((Edge){c,b});
    g[b].push_back((Edge){d,a});
  }
  scanf("%d,%d,%d,%d",&starts,&goal,&money,&hasi);
  starts--;goal--;
  money-=hasi;
  money-=daikusutora();
  money-=daikusutora();
  cout<<money<<endl;
}

int daikusutora(){
  for(int i=0;i<21;i++){
   D[i]=INF;
  }
  priority_queue<P,vector<P>,greater<P> >que;
  D[starts]=0;
  que.push(P(0,starts));
  while(!que.empty()){
    P p=que.top();que.pop();
    int now =p.F;
    int place =p.S;
    for(int i=0;i<g[place].size();i++){
      if(D[g[place][i].to]>now+g[place][i].cost){
	D[g[place][i].to]=now+g[place][i].cost;
	que.push(P(D[g[place][i].to],g[place][i].to));
      }
    }
  }
  int temp;
  temp=starts;
  starts=goal;
  goal=temp;
  return D[starts];
}