
#include <iostream>
#include <vector>
//#include <algorthm>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int MAX  = 1<<28;
int main(){
  int n,m;
  cin >> n >> m;
  vector<vector<int> > map1(n,vector<int>(n,MAX));
  //vector<vector<int> > map2(n,vector<int>(n,MAX));
  for(int i = 0;i < m;i++){
    int a,b,c,d;
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    // cout << a << " "<<  b << " "<< c << " "<<  d << " " << endl;
    map1[a-1][b-1] = c;
    map1[b-1][a-1] = d;
  }
  //  cout << "bababa" << endl;
  int x1,x2,y1,y2;
  //  cin >> x1 >> x2 >> y1 >> y2;  
  scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
  for(int l = 0;l < n;l++){
    for(int i = 0;i < n;i++){
      for(int j = 0;j < n;j++){
	
	if(map1[i][j] > map1[i][l] + map1[l][j]){
	  map1[i][j] = map1[i][l] + map1[l][j];
	}
      }
    }
  }
  cout << y1 - (y2 + map1[x1-1][x2-1] + map1[x2-1][x1-1])  << endl;
  
  return 0;
}