#include <bits/stdc++.h>

using namespace std;

const int INF = 1e9;
int dp[30][30];
int n, m, s, g, V, P;

void warshallFloyd() {
    for (int k = 0; k < n; k++)
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}

int main(void) {
    cin >> n >> m;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) {
            if (i == j) dp[i][j] = 0;
            else dp[i][j] = INF;
        }

    int a, b, c, d;
    for (int i = 0; i < m; i++) {
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        dp[a - 1][b - 1] = c;
        dp[b - 1][a - 1] = d;
    }
    scanf("%d,%d,%d,%d", &s, &g, &V, &P);

    warshallFloyd();

    cout << V - P - dp[s - 1][g - 1] - dp[g - 1][s - 1] << endl;
        
    return 0;
}
