#include <iostream>
#include <cstdio>
using namespace std;
int N, M, A, B, C, D, x1, x2, y1, y2;
int K[32][32];
const int inf = 1001001001;
int main() {
 scanf("%d%d", &N, &M);
 for (int i=1; i<=N; ++i) {
  for (int j=1; j<=N; ++j) {
   K[i][j] = inf;
  }
 }
 for (int i=0; i<M; ++i) {
  scanf("%d,%d,%d,%d", &A, &B, &C, &D);
  K[A][B] = C;
  K[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 (K[i][j] > K[i][k] + K[k][j]) { K[i][j] = K[i][k] + K[k][j]; }
   }
  }
 }
 scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
 int ans = y1 - K[x1][x2] - K[x2][x1] - y2;
 printf("%d\n", ans);
}
