#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 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 n, ll start, vector<vector<edge>>& edgemap, vector<ll>& min_cost) {
    vector<bool> done(n + 1);
    for (ll j = 0; j <= n; j++) {
        min_cost[j] = -1;
        done[j] = false;
    }
    min_cost[start] = 0;
    done[start] = true;
    priority_queue<edge, vector<edge>, greater<edge>> pq;
    for (auto next_e : edgemap[start]) {
        pq.push(next_e);
    }

    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);
            }
        }
    }
}

int main() {
    ll n, m, s, t;
    cin >> n;
    cin >> m;
    cin >> s;
    cin >> 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 init_yen = 1000000000000000LL;
    ll init_snuuk = init_yen;

    vector<ll> min_yen(n + 1);
    vector<ll> min_snuuk(n + 1);
    dijkstra(n, s, edgemap_yen, min_yen);
    dijkstra(n, t, edgemap_snuuk, min_snuuk);

    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: 24792