#include <iostream>
#include <cstdio>

using namespace std;

int main(void)
{
    int N, M;
    int A, B, C, D;
    int S, G, V, P;
    scanf("%d%d", &N, &M);
    int K[24][24];
    for (int i = 1; i <= N; i++)
        for (int j = 1; j <= N; j++)
            K[i][j] = 1e6;
    while(M)
    {
        scanf("%d,%d,%d,%d", &A, &B, &C, &D);
        K[A][B] = C;
        K[B][A] = D;
        M--;
    }
    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 - P - K[S][G] - K[G][S]) << endl;
    return 0;
}
