#include <iostream>
#include <cstdio>
using namespace std;
 
int N,M,A,B,C,D,x1,x2,y1,y2;
int K[20][20];
const int inf = 10;
 
int main(){
  for (int m=0; m < 20; m++){
  for (int n=0; n < 20; n++){
    K[m][n] = inf;
    }
  }
  scanf("%d%d", &N,&M);
  for (int i=0; i<=M-1; ++i) {
    scanf("%d,%d,%d,%d", &A,&B, &C, &D);
    K[A][B] = C;
    K[B][A] = D;
    }
    scanf("%d,%d,%d,%d", &x1,&x2, &y1, &y2);
     
  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 money = y1 -y2 -K[x1][x2] - K[x2][x1];
cerr << money << endl;
}