#if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int N, M, A, B, C, D, S, G, V, P;
int K[32][32];
const int Inf = 1000000100;

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;
  }
  scanf("%d,%d,%d,%d", &S, &G, &V, &P);
  for (int k = 1; k <= N; k++) {
    for (int i = 1; i <= N; i++) {
      for (int j = 1; j <= N; j++)
        K[i][j] = min(K[i][j],K[i][k] + K[k][j]);
    }
  }
  printf("%d\n", (V-P-K[S][G]-K[G][S]));
}

