#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
static const int MAX = 21;
static const int INFTY = (1 << 30);
int V;
std::vector<std::pair<int, int> > G[MAX];

int dijkstra(int r, int t) {
    priority_queue<std::pair<int, int> > pq;
    bool visited[MAX];
    int d[MAX];
    for (int i = 0; i < V; i++) {
        visited[i] = false;
        d[i] = INFTY;
    }
    d[r] = 0;
    pq.push({0, r}); //dist from target * -1, current node
    visited[r] = true;

    while ( !pq.empty() ) {
        pair<int, int> f = pq.top(); pq.pop();
        int current = f.second;
        visited[current] = true;

        if (d[current] < f.first * (-1)) continue;

        for (unsigned long i = 0; i < G[current].size(); i++) {
            int target = G[current][i].first;
            if (visited[target]) continue;
            if (d[target] > d[current] + G[current][i].second) {
                d[target] = d[current] + G[current][i].second;
                pq.push({d[target] * (-1), target});
            }
        }
    }
    return d[t];
}

int main()
{
    int E, source, target, cost, back, s, g, VV, P;
    scanf("%d %d", &V, &E);
    for (int i = 0; i < E; i++) {
        scanf("%d,%d,%d,%d", &source, &target, &cost, &back);
        source--; target--;
        G[source].push_back({target, cost});
        G[target].push_back({source, back});
    }
    scanf("%d,%d,%d,%d", &s, &g, &VV, &P);
    s--; g--;
    printf("%d\n", VV-P-dijkstra(s, g)-dijkstra(g, s));
    return 0;
}

