#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

class Dijkstra {
#define MAX_V 101
  typedef pair<int, int> P;

private:
  const int INF = 1e9 + 10;
  struct Edge {
    int to, cost;
    Edge(int to, int cost): to(to), cost(cost) { }
  };

  int V;
  vector<Edge> G[MAX_V];

public:

  Dijkstra(int V): V(V) { 
    if (V >= MAX_V) {
      assert(false);
    }
  }

  void AddEdge(int from, int to, int cost) {
    G[from].push_back(Edge(to, cost));
  }

  vector<int> Solve(int s) {
    priority_queue<P, vector<P>, greater<P>> que;
    vector<int> d(V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
      P p = que.top(); que.pop();
      int v = p.second;
      if (d[v] < p.first) {
        continue;
      }
      for (int i = 0; i < G[v].size(); i++) {
        Edge e = G[v][i];
        if (d[e.to] > d[v] + e.cost) {
          d[e.to] = d[v] + e.cost;
          que.push(P(d[e.to], e.to));
        }
      }
    }

    return d;
  }
};


int main() {
  int n, m;
  cin >> n >> m;
  Dijkstra dijkstra(n);
  for (int i = 0; i < m; i++) {
    int a, b, c, d;
    char delim;
    cin >> a >> delim >> b >> delim >> c >> delim >> d;
    a--;
    b--;
    
    dijkstra.AddEdge(a, b, c);
    dijkstra.AddEdge(b, a, d);
  }

  int s, g, v, p;
  char delim;
  cin >> s >> delim >> g >> delim >> v >> delim >> p;
  s--;
  g--;
  
  vector<int> dgo = dijkstra.Solve(s);
  vector<int> dreturn = dijkstra.Solve(g);

  int cost = dgo[g] + dreturn[s];

  int ans = v - p - cost;

  cout << ans << endl;
   
  
  return 0;
}