#include <iostream>
#include <vector>
#include <queue>

#define  FOR(i, c) for(__typeof((c).begin())i = (c).begin(); i != (c).end(); ++i)

using namespace std;

typedef int Weight;
const Weight INF = 1e9;

struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight) :
        src(src), dst(dst), weight(weight) { }
};

bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void shortestPath(const Graph &g, int s,
                  vector<Weight> &dist, vector<int> &prev) {
    int n = g.size();
    dist.assign(n, INF); dist[s] = 0;
    prev.assign(n, -1);
    priority_queue<Edge> Q; // "e < f" <=> "e.weight > f.weight"
    for (Q.push(Edge(-2, s, 0)); !Q.empty(); ) {
        Edge e = Q.top(); Q.pop();
        if (prev[e.dst] != -1) continue;
        prev[e.dst] = e.src;
        FOR(f,g[e.dst]) {
            if (dist[f->dst] > e.weight+f->weight) {
                dist[f->dst] = e.weight+f->weight;
                Q.push(Edge(f->src, f->dst, e.weight+f->weight));
            }
        }
    }
}

int main()
{
    int n, m;
    char ch;
    
    cin >> n >> m;
    Graph g(n);
    for (int i = 0; i < m; i++) {
        int a, b, c, d;

        cin >> a >> ch >> b >> ch >> c >> ch >> d;
        a--, b--;
        g[a].push_back(Edge(a, b, c));
        g[b].push_back(Edge(b, a, d));
    }
    
    int x1, x2, y1, y2;
    int w1, w2;
    vector<Weight> dist;
    vector<int> prev;
    cin >> x1 >> ch >> x2 >> ch >> y1 >> ch >> y2;
    x1--, x2--;
    
    shortestPath(g, x1, dist, prev);
    w1 = dist[x2];
    shortestPath(g, x2, dist, prev);
    w2 = dist[x1];
    cout << y1 - (y2 + w1 + w2) << endl;

    return 0;
}