#include <bits/stdc++.h>
/* #include <iostream> */
/* #include <vector> */
using namespace std;
#define _GLIBCXX_DEBUG

const int INF = 1001001001;
template <typename itr> void output(itr first, itr last) {
  for (auto iter = first; iter != last; ++iter) {
    for (int i : *iter) {
      if (i == INF)
        cerr << "INF"
             << ", ";
      else
        cerr << i << ", ";
    }
    cerr << endl;
  }
  cerr << endl;
}
/* auto output = [](auto first, auto last) { */
/*   cerr << '{'; */
/*   for (auto iter = first; iter != last; ++iter) { */
/*     cerr << *iter << ", "; */
/*   } */
/*   cerr << '}' << endl; */
/* }; */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<vector<int>> K(n + 1, vector<int>(n + 1, INF));
  for (int i = 0; i < m; i++) {
    int a, b, c, d;
    scanf("%d,%d,%d,%d", &a, &b, &c, &d);
    K[a][b] = c;
    K[b][a] = d;
  }
  int s, g, V, P;
  scanf("%d,%d,%d,%d", &s, &g, &V, &P);
  for (int k = 1; k <= n; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (K[i][j] > K[i][k] + K[k][j]) {
          K[i][j] = K[i][k] + K[k][j];
        }
      }
    }
  }
  cout << V - P - K[s][g] - K[g][s] << endl;
}

