#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>

#define dbg if(0)
using namespace std;
#define ll long long

std::vector<std::string> split(const std::string& input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

int main(){
    int n,m;
    int map[20][20];
    string ans;
    cin >> n>>m;
    for(int i=0;i<20;i++){
        for(int j=0;j<20;j++){
            map[i][j]=151919;
        }
    }
    for(int i=0;i<m;i++){
        int a[4];
        string mojir;
        cin >> mojir;
        int l=0;
        for (const std::string& s : split(mojir, ',')) {
            dbg std::cout << s << std::endl;
            a[l]=stoi(s);
            l++;
        }
        map[a[0]-1][a[1]-1]=a[2];
        map[a[1]-1][a[0]-1]=a[3];
//        map[a-1][b-1]=c;
//        map[b-1][a-1]=d;
    }
    int s,g,V,P;
    int a[4];
    string mojir;
    cin >> mojir;
    int l=0;
    for (const std::string& s : split(mojir, ',')) {
        dbg std::cout << s << std::endl;
        a[l]=stoi(s);
        l++;
    }
    s=a[0];
    g=a[1];
    V=a[2];
    P=a[3];
    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if (map[i][j]>map[i][k]+map[k][j]){
                    map[i][j]=map[i][k]+map[k][j];
                }
            }
        }
    }
    dbg{
        for(int i=0;i<20;i++){
            cout <<"Debug"<<i<<endl;;
            for(int j=0;j<20;j++){
                cout << map[i][j]<<" ";
            }
            cout <<endl;
        }
    }

    cout<<(V-P)-(map[s-1][g-1]+map[g-1][s-1])<<endl;
    

    return 0;
}
