#include <bits/stdc++.h>

#define REP(i, n) for(int i = 0; i < n; i++)
#define inf 1000000000
using namespace std;

void show(int n, vector<vector<int>> A)
{
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cout << A[i][j] << " ";
        }
        cout << endl;
    } 
}

int main()
{   
    int n, m;
    cin >> n >> m;

    vector<vector<int>> K(30, vector<int>(30));
    int a, b, c, d;
    string str;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            K[i][j] = inf;
        }
    }

    REP(i, m) {
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);

        K[a][b] = c;
        K[b][a] = d;
    }

    int s, g, V, P;
    scanf("%d,%d,%d,%d", &s, &g, &V, &P);

    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (K[i][j] > K[i][k] + K[k][j])
                    K[i][j] = K[i][k] + K[k][j];
            }
        }
    }

    cout << V - K[s][g] - K[g][s] - P << endl;
}
