#include <bits/stdc++.h>
using namespace std;

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

int main() {
  scanf("%d%d", &N, &M);

  for (int i = 0; i<M; i++) {
    for (int j = 0; j<M; j++) {
      K[i][j] = inf;
    }
  }

  for (int i=0; i<M; i++) {
    scanf("%d, %d, %d, %d", &A, &B, &C, &D);
    K[A-1][B-1] = C;
    K[B-1][A-1] = D;
  }
  scanf("%d, %d, %d, %d", &S, &G, &V, &P);

  for (int k=0; k<N; k++) {
    for (int i=0; i<N; i++) {
      for (int j=0; j<N; j++) {
        K[i][j] = min(K[i][j], K[i][k] + K[k][j]);
      }
    }
  }

  cout << V - P - K[S-1][G-1] - K[G-1][S-1] << endl;

}

