#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;

typedef pair<int, int> P;
struct edge { int to, cost; };

const int INF = 10000000;

int main()
{
    int n,m;
    while(cin >> n && n) {
        cin >> m;
        vector<edge> G[n+1];
        for(int i = 0; i < m; i++) {
            int a, b, c, d;
            scanf("%d,%d,%d,%d\n", &a, &b, &c, &d);
            G[a].push_back((edge){b, c});
            G[b].push_back((edge){a, d});
        }
        
        int x1, x2, y1, y2;
        scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
        
        priority_queue<P, vector<P>, greater<P> > que;
        int dist1[n+1];
        fill(dist1, dist1 + n + 1, INF);
        dist1[x1] = 0;
        que.push(P(0, x1));
        while(!que.empty()) {
            P p = que.top(); que.pop();
            int v = p.second;
            if(dist1[v] < p.first) continue;
            for(int i = 0; i < G[v].size(); i++) {
                edge e = G[v][i];
                if(dist1[e.to] > dist1[v] + e.cost) {
                    dist1[e.to] = dist1[v] + e.cost;
                    que.push(P(dist1[e.to], e.to));
                }
            }
        }

        priority_queue<P, vector<P>, greater<P> > que2;
        int dist2[n+1];
        fill(dist2, dist2 + n + 1, INF);
        dist2[x2] = 0;
        que2.push(P(0, x2));
        while(!que2.empty()) {
            P p = que2.top(); que2.pop();
            int v = p.second;
            if(dist2[v] < p.first) continue;
            for(int i = 0; i < G[v].size(); i++) {
                edge e = G[v][i];
                if(dist2[e.to] > dist2[v] + e.cost) {
                    dist2[e.to] = dist2[v] + e.cost;
                    que2.push(P(dist2[e.to], e.to));
                }
            }
        }

        cout << y1 - y2 - dist1[x2] - dist2[x1] << endl;
    }
    return 0;
}