#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int cost[20][20];
int INF = 1e9;
int n;

int dikst(int s, int g)
{
    bool used[n] = {};
    int d[n];
    rep(i, n) d[i] = INF;
    d[s] = 0;
    while (1)
    {
        int minv = INF;
        int u;
        rep(i, n)
        {
            if (!used[i] && d[i] < minv)
            {
                minv = d[i];
                u = i;
            }
        }
        if (minv == INF)
            break;

        used[u] = 1;
        rep(i, n)
        {
            if (!used[i] && cost[u][i] != INF && d[i] > cost[u][i] + d[u])
                d[i] = cost[u][i] + d[u];
        }
    }
    return d[g];
}

int main()
{
    int m;
    cin >> n >> m;
    rep(i, 20) rep(j, 20) cost[i][j] = INF;
    char ch;
    rep(i, m)
    {
        int a, b, c, d;
        cin >> a >> ch >> b >> ch >> c >> ch >> d;
        --a, --b;
        cost[a][b] = c;
        cost[b][a] = d;
    }

    int s, g, v, p;
    cin >> s >> ch >> g >> ch >> v >> ch >> p;
    --s, --g;

    OP(v - p - dikst(s, g) - dikst(g, s));
    return 0;
}
