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

using namespace std;

constexpr int M_MAX = 100;
constexpr int N_MAX = 20;
constexpr int INF = 1e8;

int main()
{
  int n,m,a,b,c,d,s,g,V,P,reward;
  struct edge {
    edge(int t, int c)
      : to_(t), cost_(c) {};
    int to_;
    int cost_;
  };
  vector<edge>G[M_MAX];
  typedef pair<int,int> PII;
  vector<int> q(N_MAX);
  priority_queue<PII,vector<PII>,greater<PII>> que;

  cin >> n;
  cin >> m;
  for (int i=0;i<m;++i) {
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    G[a].push_back(edge(b,c));
    G[b].push_back(edge(a,d));
  }
  scanf("%d,%d,%d,%d",&s,&g,&V,&P);

  reward = V-P;

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

  while(!que.empty()){
    PII k  = que.top();
    que.pop();
    int l = k.first;

for(int i=0;i<G[l].size();i++){
      edge r = G[l][i];
      if(q[r.to_] > q[l] + r.cost_){
        q[r.to_] = q[l] + r.cost_;
        que.push(PII(r.to_, q[r.to_]));
      }
    }
  }

  reward = reward - q[g];

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

  while(!que.empty()){
    PII e = que.top();
    que.pop();
    int l = e.first;

    for(int i=0;i<G[l].size();i++){
      edge w = G[l][i];
      if(q[w.to_] > q[l] + w.cost_){
        q[w.to_] = q[l] + w.cost_;
        que.push(PII(w.to_, q[w.to_]));
      }
}
  }

  reward = reward - q[s];

  cout << reward << endl;

  return 0;
}