#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;

//---------------------------------------------------------------
// ------ graph ------ //
using Weight = int;
using Flow = int;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) { }
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // pqが降順のため
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
using Edges = vector<Edge>;
struct Graph {
    vector<Edges> adj;
    Graph(int n) : adj(n) { }
    int size() { return adj.size(); }
    Edges operator [] (int v) { return adj[v]; }
    void add_edge(int a, int b, Weight w = 1) { // graph
        adj[a].emplace_back(a, b, w);
        adj[b].emplace_back(b, a, w);
    }
    void add_arc(int a, int b, Weight w = 1) {  // digraph
        adj[a].emplace_back(a, b, w);
    }
};
using Array = vector<Weight>;
using Matrix = vector<Array>;

// ------ WarshallFloyd ------ //
Matrix WarshallFloyd(Graph &g) {
    int n = g.size();
    Matrix d(n, Array(n, INF));
    for (int i = 0; i < n; i++) d[i][i] = 0;
    for (int i = 0; i < n; i++) for (Edge &e : g[i]) {
        d[e.src][e.dst] = min(d[e.src][e.dst], e.weight);
    }
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
            if (d[i][k] != INF && d[k][j] != INF) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    return d;
}
//---------------------------------------------------------------

int main() {
    int n, m; scanf("%d%d", &n, &m);
    Graph g(n);
    for (int i = 0; i < m; i++) {
        int a, b, c, d;
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        g.add_arc(a - 1, b - 1, c);
        g.add_arc(b - 1, a - 1, d);
    }
    int S, G, V, P; scanf("%d,%d,%d,%d", &S, &G, &V, &P);
    Matrix d = WarshallFloyd(g);
    int ans = V - P - d[S - 1][G - 1] - d[G - 1][S - 1];
    printf("%d\n", ans);
    return 0;
}
