#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

void print() { cout << endl; }
template <typename Head, typename... Tail>
void print(Head head, Tail... tail) {
    int size = sizeof...(Tail);
    cout << head;
    if (size > 0) {
        cout << " ";
    }
    print(tail...);
}

void print0() {}
template <typename Head, typename... Tail>
void print0(Head head, Tail... tail) {
    cout << head;
    print0(tail...);
}

struct edge {
    ll u;
    ll v;
    ll cost;
};
bool operator<=(const edge& lhs, const edge& rhs) {
    return lhs.cost <= rhs.cost;
}
bool operator<(const edge& lhs, const edge& rhs) {
    return lhs.cost < rhs.cost;
}
bool operator>=(const edge& lhs, const edge& rhs) {
    return lhs.cost >= rhs.cost;
}
bool operator>(const edge& lhs, const edge& rhs) {
    return lhs.cost > rhs.cost;
}
bool operator==(const edge& lhs, const edge& rhs) {
    return lhs.cost == rhs.cost;
}
bool operator!=(const edge& lhs, const edge& rhs) {
    return lhs.cost != rhs.cost;
}

void dijkstra(ll start, vector<vector<edge>>& edgemap, vector<ll>& min_cost) {
    vector<bool> done(edgemap.size(), false);
    priority_queue<edge, vector<edge>, greater<edge>> pq;

    pq.push(edge{u : -1, v : start, cost : 0});
    while (!pq.empty()) {
        edge e = pq.top();
        pq.pop();
        if (done[e.v]) {
            continue;
        }
        done[e.v] = true;
        min_cost[e.v] = e.cost;
        for (auto next_e : edgemap[e.v]) {
            if (!done[next_e.v]) {
                edge total_next_e = next_e;
                total_next_e.cost = min_cost[next_e.u] + next_e.cost;
                pq.push(total_next_e);
            }
        }
    }
}

// dijkstra (ダイクストラ)
// https://atcoder.jp/contests/soundhound2018-summer-qual/tasks/soundhound2018_summer_qual_d
int main() {
    ll n, m, s, t;
    cin >> n >> m >> s >> t;
    vector<edge> edges;
    vector<vector<edge>> edgemap_yen(n + 1);
    vector<vector<edge>> edgemap_snuuk(n + 1);
    for (ll j = 0; j < m; j++) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        edgemap_yen[u].push_back(edge{u : u, v : v, cost : a});
        edgemap_yen[v].push_back(edge{u : v, v : u, cost : a});
        edgemap_snuuk[u].push_back(edge{u : u, v : v, cost : b});
        edgemap_snuuk[v].push_back(edge{u : v, v : u, cost : b});
    }
    ll INF = 9e18;
    vector<ll> min_yen(n + 1, INF);
    vector<ll> min_snuuk(n + 1, INF);
    dijkstra(s, edgemap_yen, min_yen);
    dijkstra(t, edgemap_snuuk, min_snuuk);

    ll init_yen = (ll)1e15;
    vector<pair<ll, ll>> last_snuuk(n + 1);
    for (int i = 1; i <= n; i++) {
        last_snuuk[i] = make_pair(i, init_yen - min_yen[i] - min_snuuk[i]);
    }
    last_snuuk[0] = make_pair(0, -1);

    sort(last_snuuk.begin(), last_snuuk.end(), [](pair<ll, ll> p, pair<ll, ll> q) { return p.second > q.second; });

    ll year = 0;
    ll city = 0;
    vector<ll> result(n);
    while (year < n) {
        if (last_snuuk[city].first > year) {
            result[year] = last_snuuk[city].second;
            year++;
        } else {
            city++;
        }
    }

    for (auto r : result) {
        cout << r << endl;
    }
}


Measured memory_bytes: 24800