#include <bits/stdc++.h>
using namespace std;
#define 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 a;
    ll b;
};
int main() {
    ll n, m, s, t;
    cin >> n;
    cin >> m;
    cin >> s;
    cin >> t;
    // s--;
    // t--;
    vector<edge> edges;
    vector<vector<edge>> edgemap(n + 1);
    for (ll j = 0; j < m; j++) {
        edge e;
        cin >> e.u;
        cin >> e.v;
        cin >> e.a;
        cin >> e.b;
        edge ee;
        ee.u = e.v;
        ee.v = e.u;
        ee.a = e.a;
        ee.b = e.b;
        // cin >> ee.v;
        // cin >> ee.u;
        // cin >> ee.a;
        // cin >> ee.b;
        // e.u--;
        // e.v--;
        edges.push_back(e);
        edgemap[e.u].push_back(e);
        edgemap[ee.u].push_back(ee);
    }
    vector<ll> min_yen(n + 1);
    for (ll j = 0; j <= n; j++) {
        min_yen[j] = -1;
    }
    min_yen[s] = 0;
    queue<ll> nodestack;
    set<ll> instack;
    nodestack.push(s);
    while (!nodestack.empty()) {
        ll nod = nodestack.front();
        nodestack.pop();
        instack.erase(nod);
        for (auto e : edgemap[nod]) {
            auto yen_cost = min_yen[nod] + e.a;
            if (min_yen[e.v] == -1 || min_yen[e.v] > yen_cost) {
                min_yen[e.v] = yen_cost;
                if (instack.count(e.v) == 0) {
                    nodestack.push(e.v);
                    instack.insert(e.v);
                }
            }
        }
    }

    vector<ll> min_snuuk(n + 1);
    for (ll j = 0; j <= n; j++) {
        min_snuuk[j] = -1;
    }
    min_snuuk[t] = 0;
    queue<ll> k_nodestack;
    set<ll> k_instack;
    k_nodestack.push(t);
    while (!k_nodestack.empty()) {
        ll nod = k_nodestack.front();
        k_nodestack.pop();
        k_instack.erase(nod);
        for (auto e : edgemap[nod]) {
            auto snuuk_cost = min_snuuk[nod] + e.b;
            if (min_snuuk[e.v] == -1 || min_snuuk[e.v] > snuuk_cost) {
                min_snuuk[e.v] = snuuk_cost;
                if (k_instack.count(e.v) == 0) {
                    k_nodestack.push(e.v);
                    k_instack.insert(e.v);
                }
            }
        }
    }

    vector<pair<ll, ll>> last_snuuk(n + 1);
    ll init_yen = 1000000000000000LL;
    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: 22172