#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<queue>

const int INFTY = 1 << 22;
using namespace std;

class Town{
public:
  Town(){
    this->init();
  }
  void init(void){
    this->cost = INFTY;
    this->vis = false;
  }
  int cost;
  bool vis;
  vector<int> vcon;
  vector<int> vcost;
  bool operator <(const Town *t) const{
    return cost < t->cost;
  };
};

void Dijkstra( map<int, Town> &G, int st ){
  priority_queue<Town*> q;
  Town *pt;

  G[st].cost = 0;
  q.push( &G[st] );

  while( !q.empty() ){
    pt = q.top();
    q.pop();
    pt->vis = false;

    for(int i = 0; i < pt->vcon.size(); i++){
      if( G[ pt->vcon[i] ].cost > pt->cost + pt->vcost[i] ){
	G[ pt->vcon[i] ].cost = pt->cost + pt->vcost[i];
	if( G[ pt->vcon[i] ].vis ){
	  continue;
	}else{
	  G[ pt->vcon[i] ].vis = true;
	  q.push( &G[ pt->vcon[i] ] );
	}
      }
    }
  }
}
void ResetGraph( map<int, Town> &G, vector<int> &V){
  for(int i = 0; i < V.size(); i++ ){
    G[ V[i] ].init();
  }
}
int main(void){
  int n,m;
  int s,g;
  int money,pay;
  map<int, Town> G;
  vector<int> V;

  scanf("%d%d", &n, &m);
  for(int i = 0; i < m; i++){
    int a,b,c,d;

    scanf("%d,%d,%d,%d", &a, &b, &c, &d);
    V.push_back( a );
    V.push_back( b );
    G[a].vcon.push_back( b );
    G[a].vcost.push_back( c );
    G[b].vcon.push_back( a );
    G[b].vcost.push_back( d );
  }
  scanf("%d,%d,%d,%d", &s, &g, &money, &pay);

  Dijkstra( G , s );

  money -= pay;
  money -= G[ g ].cost;

  ResetGraph( G , V );
  Dijkstra( G , g );

  money -= G[ s ].cost;

  cout << money << endl;
  return 0;
}