#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n, m;
  cin >> n >> m;

  const int INF = 1 << 30;
  int dis[20][20];
  fill((int*)dis, (int*)(dis + n), INF);
  for (int i = 0; i < n; i++) dis[i][i] = 0;
  for (int i = 0; i < m; i++) {
    int a, b, c, d;
    char ch;
    cin >> a >> ch >> b >> ch >> c >> ch >> d;
    a--, b--;
    dis[a][b] = c;
    dis[b][a] = d;
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (dis[i][k] == INF || dis[k][j] == INF) continue;
        dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
      }
    }
  }
  int s, g, V, P;
  char ch;
  cin >> s >> ch >> g >> ch >> V >> ch >> P;
  s--, g--;
  cout << V - P - dis[s][g] - dis[g][s] << endl;

  return 0;
}
