#include <iostream>
#include <algorithm>
#define INF 10000000

using namespace std;

int cost[21][21];
int m,n;

void W(){

  for(int k = 0 ; k < n ; k++ ){
    for(int i = 0 ; i < n ; i++ ){
      for(int j = 0 ; j < n ; j++ ){
	cost[i][j] = min(cost[i][j],cost[i][k]+cost[k][j]);
      }
    }
  }

}

int main(){

  cin >> n >> m;
  n++;

      for(int i = 0 ; i < n ; i++ ){
	for(int j = 0 ; j < n ; j++ ){
	  if(i == j )cost[i][j] = 0;
	  else cost[i][j] = INF;
	}
      }

  char ch;

  for(int i = 0 ; i < m ; i++ ){
    int a,b,c,d;

    cin >> a >> ch >> b >> ch >> c >> ch >> d;
    cost[a][b] = c;
    cost[b][a] = d;

  }

  int s,g,mone,hasira;
  cin >> s >> ch >> g >> ch >> mone >> ch >> hasira;

  W();

  int go = cost[s][g];
  int back = cost[g][s];

  cout << mone - (go+back+hasira) << endl;

  return 0;
}