#include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef struct edge{
  edge(int a, int b):to(a),cost(b){};
  int to, cost;
}edge;
typedef struct state{
  state(int a, int b):v(a),cost(b){};
  int v, cost;
  bool operator<(const state s)const{return cost < s.cost;}
  bool operator>(const state s)const{return cost > s.cost;}
}state;

int dijkstra(vector<vector<edge> > &g, int start, int goal){
  priority_queue<state, vector<state>, greater<state> > que;
  que.push(state(start, 0));
  vector<int> ans(g.size(), 1e9);
  ans[start] = 0;
  while(not que.empty()){
    int v = que.top().v;
    int c = que.top().cost;
    que.pop();
    if(ans[v] < c)continue;
    if(v == goal)break;
    for (int i = 0; i < g[v].size(); i++) {
      int nv = g[v][i].to;
      if(ans[nv] > c + g[v][i].cost){
        ans[nv] = c + g[v][i].cost;
        que.push(state(nv, ans[nv]));
      }
    }
  }
  return ans[goal];
}

int main(){
  int n, m;
  std::cin >> n >> m;
  vector<vector<edge> > g(n);
  for (int i = 0; i < m; i++) {
    int a, b, c, d;
    scanf("%d,%d,%d,%d", &a, &b, &c, &d);
    a--, b--;
    g[a].push_back(edge(b, c));
    g[b].push_back(edge(a, d));
  }
  int start, goal, v, p;
  scanf("%d,%d,%d,%d", &start, &goal, &v, &p);
  start--, goal--;
  std::cout << v - p - (dijkstra(g, start, goal) + dijkstra(g, goal, start)) << std::endl;
  
  return 0;
}