#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits> // int ???????????§????????????????????????
using namespace std;
const int MAX_V = 100000; // ???????????°????????§???
const int MAX_E = 500000; // ????????°????????§???
const int INF = 10000; // ???????????§?????????(int ???????????§???)
struct E {
  int to, cost;
  E(int t, int c) : to(t), cost(c) {};
};
typedef pair<int, int> pii;
int v; // ????????°
vector<E> g[MAX_V]; // ??£??\?????????
int d[MAX_V]; // ??????s ????????????????????¢
void dijkstra(int s)
{
  // ??????
  fill(d, d + v, INF);
  d[s] = 0;
  // greater<pii>??§first ????°???????????????????????????????????????????
  priority_queue<pii, vector<pii>, greater<pii> > q;
  q.push(pii(0, s));
  // ??????s ????????????????????????????????¢????¨????
  while(!q.empty()){
    // ???????¢???????????????????????????????????????¢???????°???????????????¢???
    // ?????????????????¢???????????????????????¢????¢??????????
    pii p = q.top();
    q.pop();
    int from = p.second;
    if(d[from] < p.first)continue; // ???????????¢??§??????????????°??????
    // ???????????§????????°??????from ??????????????¢?¢????
    // ???????????¢????¢?????????????????????£??\????????????????????±?????´??°
    for(int i = 0; i < g[from].size(); ++i){
      int to = g[from][i].to;
      int cost = g[from][i].cost;
      if(d[to] > d[from] + cost){ // ???????????¢??¨??????????????´???
	d[to] = d[from] + cost;
	q.push(pii(d[to], to)); // ???????????¢???????£?????????????????????\
      }
    }
  }
}


int main()
{
  // ??\??????????????????gv ??????????????°???ge ???????????°???gr ????§????
  int gv, ge, gr;
  cin >> gv >> ge;
  v = gv;
  //fill(&g[0][0], &g[v][0], INF); // ??£??\??????????????????
  for(int i = 0; i < ge; ++i){
    // ??\??????????????????gs ??????????§???????gt ??????????????????gd ???????????????
    int gs, gt, gd,gd2;
    //cin >> gs >> gt >> gd >> gd2;
    scanf("%d,%d,%d,%d",&gs,&gt,&gd,&gd2);
    //printf("%d,%d,%d,%d",gs,gt,gd,gd2);

    g[gs-1].push_back(E(gt-1,gd)); // 2 ???????????????????????±????¨????
    g[gt-1].push_back(E(gs-1,gd2));
  }

  int goal,okane,daikin;

  //cin >> gr >> goal >> okane >> daikin;
  scanf("%d,%d,%d,%d",&gr,&goal,&okane,&daikin);


  dijkstra(gr-1);
  int kane=d[goal-1];
  dijkstra(goal-1);
  kane+=d[gr-1];

  // ??????????????????gr ????????????????????????????????¢

  cout << (okane-kane-daikin) << endl;
    
  return 0;
  
}