#include <cstdio>
#include <queue>
#include <vector>
using namespace std;

const int INF = 1<<29;

struct Edge {
    int src,dst,cost;
};
typedef vector<vector<Edge> > Graph;

// Shortest Path Faster Algorithm
// O(E)
void spfa(const Graph &g,int s,vector<int> &dist) {
    const int n = g.size();
    vector<bool> inQ(n, false);
    queue<int> q;

    q.push(s); fill(dist.begin(), dist.end(), INF);
    dist[s] = 0; inQ[s] = true;
    while(!q.empty()) {
        int v = q.front(); q.pop();
        inQ[v] = false;

        for(int i=0; i<g[v].size(); ++i) {
            int u = g[v][i].dst, d = g[v][i].cost;
            if(dist[v] + d < dist[u]) {
                dist[u] = dist[v] + d;
                if(!inQ[u]) {
                    q.push(u);
                    inQ[u] = true;
                }
            }
        }
    }
}

int main() {
    int n,m,a,b,c,s,t,d1,d2,d;
    scanf(" %d %d", &n, &m);
    Graph g(n);
    vector<int> dist(n);

    for(int i=0; i<m; ++i) {
        scanf(" %d,%d,%d,%d", &a, &b, &c, &d);
        a--,b--;
        g[a].push_back((Edge){a,b,c});
        g[b].push_back((Edge){b,a,d});
    }
    scanf(" %d,%d,%d,%d", &s, &t, &d1, &d2);
    s--,t--;

    spfa(g,s,dist);
    int ans = d1-d2-dist[t];
    spfa(g,t,dist);
    ans -= dist[s];
    printf("%d\n", ans);
}