#import<cstdio>
int main(){int i,j,k,a,b,c,d,n,m,D[21][21];for(i=0;i<21;i++)for(j=0;j<21;j++)D[i][j]=1e+9;scanf("%d%d",&n,&m);for(i=0;i<m;i++)scanf("%d,%d,%d,%d", &a, &b, &c, &d),D[a][b]=c,D[b][a]=d;for(k=1;k<=n;k++)for(i=1;i<=n;i++)for(j=1;j<=n;j++)D[i][j]=(D[i][j]<D[i][k]+D[k][j])?D[i][j]:D[i][k]+D[k][j];scanf("%d,%d,%d,%d",&a,&b,&c,&d);printf("%d\n",c-d-D[a][b]-D[b][a]);}