#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(){
  for (int i = 0; i < 32; ++i)
  {
    for (int j = 0; j < 32; ++j)
    {
     K[i][j]= inf;
    }
  }
  scanf("%d%d", &N, &M);
  for(int i=0; i<M; ++i){
    scanf("%d,%d,%d,%d", &A, &B, &C, &D);
    // cerr << "read " << A << " " << B << " " << C << " " << D << endl;
    K[A-1][B-1]=C;
    K[B-1][A-1]=D;
  }


  for (int k=0;k<N;k++){
    for (int i = 0; i < N; i++){
      for (int j = 0; 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);

  cout << y1-K[x1-1][x2-1]-y2-K[x2-1][x1-1]<< endl;



}