#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

bool comp(pair<int,int> p1,pair<int,int> p2)
{
    if(p1.ff!=p2.ff)
        return p1.ff<p2.ff;
    else
        return p1.ss<p2.ss;
}

int32_t main()
{                
    IOS;
    /*#ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif*/
    int n,m,S,t;
    cin>>n>>m>>S>>t;
    vector<vector<pair<int,pair<int,int>>>> g(n+1);
    for(int i=0;i<m;i++)
    {
        int u,v,a,b;
        cin>>u>>v>>a>>b;
        g[u].pb(mp(v,mp(a,b)));
        g[v].pb(mp(u,mp(a,b)));
    }
    vi distt(n+1,1e16);
    distt[t]=0;
    set<pair<int,int>> s;
    s.insert(mp(0,t));
    while(!s.empty())
    {
        pair<int,int> p=*s.begin();
        s.erase(s.begin());
        for(auto it:g[p.ss])
        {
            if(p.ff+it.ss.ss<distt[it.ff])
            {
                distt[it.ff]=p.ff+it.ss.ss;
                s.insert(mp(distt[it.ff],it.ff));
            }
        }
    } 
    vi dist(n+1,1e16);
    dist[S]=0;
    s.insert(mp(0,S));
    while(!s.empty())
    {
        pair<int,int> p=*s.begin();
        s.erase(s.begin());
        for(auto it:g[p.ss])
        {
            if(p.ff+it.ss.ff<dist[it.ff])
            {
                dist[it.ff]=p.ff+it.ss.ff;
                s.insert(mp(dist[it.ff],it.ff));
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
       // trace3(i,distt[i],dist[i]);
        s.insert(mp(dist[i]+distt[i],i));
    }
    int k=1e15;
    for(int i=0;i<n;i++)
    {
        pair<int,int> p;
        p=*s.begin();
       // trace2(p.ff,p.ss);
        while(!s.empty() && p.ss<=i)
        {
            s.erase(p);
            p=*s.begin();
        }
        cout<<k-p.ff<<endl;;
    }
    return 0;
}

Measured memory_bytes: 18560