//A_reward_for_a_Carpenter.cc

#include <iostream>
#include <cstdio>
#define Inf 1001001001
using namespace std;

int main()
{
    int n,m,s,g,V,P,i,j,k,last;
    int K[32][32];
    scanf("%d",&n);
    scanf("%d",&m);
    //cin >> n >> m;
    int a[110],b[110],c[110],d[110];
    for(i=1;i<32;i++)
        for(j=1;j<=32;j++)
            K[i][j]=Inf;
    for(i=0;i<m;i++)
    {
        scanf("%d,%d,%d,%d",&a[i],&b[i],&c[i],&d[i]);
        //cin >> a[i] >> b[i] >> c[i] >> d[i];
        K[a[i]][b[i]]=c[i];
        K[b[i]][a[i]]=d[i];
    }
    //cin >> s >> g >> V >> P;
    scanf("%d,%d,%d,%d",&s,&g,&V,&P);
    for(k=1;k<=n;k++)
        for(i=1;i<=n;i++)
            for(j=1;j<=n;j++)
            {
                if(K[i][j] > K[i][k] + K[k][j])
                    K[i][j] = K[i][k] + K[k][j];
            }
    last = V - P - K[s][g] - K[g][s];
    cout << last << endl;
    return 0;
}
