#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
const int INF = 10010;

int n, m, s, g, V, P;

int main()
{
    scanf("%d%d", &n, &m);
    vector<vector<int>> K(n, vector<int>(n, INF));
    rep(i, m)
    {
        int a, b, c, d;
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        K[a - 1][b - 1] = c;
        K[b - 1][a - 1] = d;
    }
    scanf("%d,%d,%d,%d", &s, &g, &V, &P);
    rep(k, n) rep(i, n) rep(j, n)
    {
        if (K[i][j] > K[i][k] + K[k][j])
            K[i][j] = K[i][k] + K[k][j];
    }
    int ans;
    ans = V - P - K[s - 1][g - 1] - K[g - 1][s - 1];
    printf("%d\n", ans);
    return 0;
}
