#include <iostream>
#include <cstdio>
using namespace std;

int N, M, A, B, C, D, x1, x2, y1, y2, Ans;
int main(){
  scanf("%d%d", &N, &M);
  int K[N+10][N+10];
  for(int i=1; i<=N; i++){
    for(int j=1; j<=N; j++){
      K[i][j] = 2000;
    }
  }
  for(int i=1; i<=M; i++){
    scanf("%d,%d,%d,%d", &A, &B, &C, &D);
    //cerr << "read " << A << ' ' << B << ' ' << C << ' ' << D << endl;
    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];
        }
      }
    }
  }

  int s, g, V, P;
  scanf("%d,%d,%d,%d", &s, &g, &V, &P);
  Ans = V - P - K[s][g] - K[g][s];
  printf("%d\n", Ans);
  return 0;
}

