#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return (x<0||x>=n||y<0||y>=m)?false:true;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> P;
vector<P> v[30];
int n,m;

int bfs(int s, int t) {
  int d[n+1];
  fill(d,d+n+1,MAX);
  d[s]=0;
  priority_queue<P,vector<P>,greater<P> > que;
  que.push(P(0,s));
  while(!que.empty()) {
    int cost=que.top().F,x=que.top().S;que.pop();
    //PR(cost,x);
    //if(x==t) break;
    for(int i=0; i<v[x].size(); i++) {
      int y=v[x][i].F,c=v[x][i].S;
      if(d[y]<cost+c) continue;
      d[y]=min(d[y],cost+c);
      que.push(P(d[y],y));
    }
  }
  return d[t];
}

int main() {
  cin >> n >> m;
  rep(i,m) {
    int a,b,c,d;
    scanf("%d%*c%d%*c%d%*c%d",&a,&b,&c,&d);
    v[a].pb(P(b,c));
    v[b].pb(P(a,d));
  }
  int s,t,sum,z;
  scanf("%d%*c%d%*c%d%*c%d",&s,&t,&sum,&z);
  sum-=z;
  sum-=bfs(s,t);  sum-=bfs(t,s);
  pr(sum);
  return 0;
}
