#include <iostream>
#include <cstdio>
using namespace std;
#define MAX 21
#define INF 9999999

int grapha[MAX][MAX],v[MAX],mini,minnum,n;
bool visited[MAX];

int dijkstra(int x1, int x2){
  for(int i = 0 ; i < MAX ; i++){
    v[i] = INF;
    visited[i] = false;
  }

  v[x1] = 0;

  while(true){
    mini = INF;
    for(int i = 1 ; i <= n ; i++){
      if(v[i] < mini && !visited[i]){
	mini = v[i];
	minnum = i;
      }
    } 
    if(mini == INF) break;
    visited[minnum] = true;
    for(int j = 1 ; j <= n ; j++){
      if(grapha[minnum][j]+v[minnum] < v[j] && grapha[minnum][j]!=INF){
	v[j] = v[minnum] + grapha[minnum][j];
      }
    }
  }
  return v[x2];
}

int main(){
  int m,a,b,c,d,x1,x2,y1,y2,v[MAX];

  for(int i = 0 ; i < MAX ; i++){
    for(int j = 0 ; j < MAX ; j++){
      grapha[i][j] = INF;
    }
    visited[i] = false;
    v[i] = INF;
  }

  cin >> n >> m;
  for(int i = 0 ; i < m ; i++){
    scanf("%d,%d,%d,%d" ,&a ,&b ,&c ,&d);
    grapha[a][b] = c;
    grapha[b][a] = d; 
  }

  scanf("%d,%d,%d,%d" ,&x1, &x2 ,&y1 ,&y2);
  cout << y1-y2-(dijkstra(x1,x2)+dijkstra(x2,x1)) << endl;

  return 0;
}