#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

struct edge{
    LL next;
    LL cost;
    edge(){

    }

    edge(LL a,LL b):next(a),cost(b){

    }

    bool operator <(const edge& right)const{
        return cost < right.cost;
    }

    bool operator >(const edge& right)const{
        return cost > right.cost;
    }
};

struct point{
    LL i;
    LL cost;
    point(LL a,LL b):i(a),cost(b){

    }

    bool operator <(const point& right)const{
        return cost < right.cost;
    }

    bool operator >(const point& right)const{
        return cost > right.cost;
    }

};

vector<vector<edge>> s;
vector<vector<edge>> f;
vector<LL> sresult;
vector<LL> fresult;

void dijkstra_s(LL start,LL n){
    priority_queue<point,vector<point>,greater<point>> pq;
    vector<bool> close(n+1,false);
    pq.push(point(start,0));
    while(!pq.empty()){
        point tmp = pq.top();
        pq.pop();
        if(close[tmp.i]){
            continue;
        }
        close[tmp.i] = true;
        sresult[tmp.i] = tmp.cost;
        for(int i = 0; i < s[tmp.i].size(); i++){
            if(!close[s[tmp.i][i].next]){
                pq.push(point(s[tmp.i][i].next,tmp.cost + s[tmp.i][i].cost));
            }
        }
    }
}

void dijkstra_f(LL start,LL n){
    priority_queue<point,vector<point>,greater<point>> pq;
    vector<bool> close(n+1,false);
    pq.push(point(start,0));
    while(!pq.empty()){
        point tmp = pq.top();
        pq.pop();
        if(close[tmp.i]){
            continue;
        }
        close[tmp.i] = true;
        fresult[tmp.i] = tmp.cost;
        for(int i = 0; i < f[tmp.i].size(); i++){
            if(!close[f[tmp.i][i].next]){
                pq.push(point(f[tmp.i][i].next,tmp.cost + f[tmp.i][i].cost));
            }
        }
    }
}

struct mypair{
    LL a;
    LL idx;

    mypair(){}
    mypair(LL b,LL i):a(b),idx(i){

    }
    bool operator <(const mypair& right)const{
        return a < right.a;
    }

    bool operator >(const mypair& right)const{
        return a > right.a;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    LL n,m,start,to;
    cin >> n >> m >> start >> to;
    s = vector<vector<edge>>(n+1);
    f = vector<vector<edge>>(n+1);
    sresult = vector<LL>(n+1,0);
    fresult = vector<LL>(n+1,0);

    for(int i = 0; i < m; i++){
        LL u,v,a,b;
        cin >> u >> v >> a >> b;
        s[u].push_back(edge(v,a));
        s[v].push_back(edge(u,a));
        f[u].push_back(edge(v,b));
        f[v].push_back(edge(u,b));
    }

    dijkstra_s(start,n);
    dijkstra_f(to,n);

    vector<LL> ans(n);
    vector<mypair> t(n+1);
    for(int i = 1; i < n+1; i++){
        t[i] = mypair(1000000000000000 - sresult[i] - fresult[i],i);
    }
    sort(t.begin()+1,t.end(),greater<mypair>());
    LL sel = 1;
    for(int i = 0; i < n; i++){
        while(t[sel].idx <= i){
            sel++;
        }
        ans[i] = t[sel].a;
    }

    for(int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 20524