#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define REP(i, n) for(int i = 0; i < (n); i++)
using namespace std;

const int MAX_V = 20;
const int MAX_E = 500000;
const int INF = INT_MAX;

struct E{
  int to, cost;
  E(int t, int c) : to(t), cost(c) {};
};
typedef pair<int, int> pii;

int v;
vector<E> g[MAX_V];
int d[MAX_V];

void dijkstra(int s)
{
  fill(d, d + v, INF);
  d[s] = 0;
  priority_queue<pii, vector<pii>, greater<pii> > q;
  q.push(pii(0, s));
  
  while(!q.empty()){
    pii p = q.top();
    q.pop();
    int from = p.second;
    if(d[from] < p.first) continue;
    
    for(int i = 0; i < g[from].size(); ++i){
      int to = g[from][i].to;
      int cost = g[from][i].cost;
      
      if(d[to] > d[from] + cost){
        d[to] = d[from] + cost;
        q.push(pii(d[to], to));
      }
    }
  }
}

int main()
{
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  REP(i, m){
    int a1, b1, c1, d1;
    scanf("%d,%d,%d,%d", &a1, &b1, &c1, &d1);
    g[a1].push_back(E(b1, c1));
    g[b1].push_back(E(a1, d1));
  }
  v = n;
  int x1, x2, y1, y2;
  scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
  dijkstra(x1);
  int go = d[x2];
  dijkstra(x2);
  int back = d[x1];
  cout << y1 - go - back - y2 << endl;
}