#include <iostream>
#include <cstdio>
using namespace std;

const int inf = 1001001001;
int n, m, a, b, c, d, s, g, v, p;
int K[32][32] = {};

void show()
{
    for (int i = 1; i < n + 1; i++)
    {
        for (int j = 1; j < n + 1; j++)
        {
            cout << K[i][j];
            if (j != n)
            {
                cout << " ";
            }
        }
        cout << endl;
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < 32; i++)
    {
        for (int j = 0; j < 32; j++)
        {
            K[i][j] = inf;
        }
    }
    for (int i = 0; i < m; i++)
    {
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        //cerr << "read " << a << " " << b << " " << c << " " << d << endl;
        K[a][b] = c;
        K[b][a] = d;
    }
    scanf("%d,%d,%d,%d", &s, &g, &v, &p);
    // show();
    for (int k = 1; k < n + 1; k++)
    {
        for (int i = 1; i < n + 1; i++)
        {
            for (int j = 1; j < n + 1; j++)
            {
                if (K[i][j] > K[i][k] + K[k][j])
                {
                    K[i][j] = K[i][k] + K[k][j];
                }
            }
        }
    }
    //show();
    //cout << K[s][g] << K[g][s] << endl;
    cout << v - p - K[s][g] - K[g][s] << endl;
    return 0;
}

