#include <iostream>

using namespace std;

int n,m,a,b,c,d,s,g,V,P;
char S;
int adm[22][22]={0}; //adjacency matrix
const int inf=1000000000;

int main()
{
    cin >> n >> m;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            adm[i][j]=inf;
        }
    }

    for(int i=0;i<m;i++)
    {
        cin >> a >> S >> b >> S >> c >> S >> d;
        adm[a][b]=c;
        adm[b][a]=d;
    }

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

    cin >> s >> S >> g >> S >> V  >> S >> P;
    cout << V-P-adm[s][g]-adm[g][s] << endl;
    return 0;
}
