#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

using std::min;
using std::max;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

ll inq(ll x, ll y, ll mod)
{
    if (y == 0) return 1;
    ll l = inq(x, y / 2, mod);
    if (y % 2) return l * l % mod * x % mod;
    return l * l % mod;
}

ll rev(ll x, ll mod)
{
    return inq(x, mod - 2, mod);
}

inline int nextInt()
{
    int x = 0;
    char c = getchar();
    int mi = (c == '-');
    if (c == '-') c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    if (mi) return x * -1;
    return x;
}


ll n, m, ss, tt;
vector<pll> g1[500000], g2[500000];
ll A[500000], B[500000];
const ll INF = 1e15;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> ss >> tt;
    for (int i = 0; i < m; i++)
    {
        int v, u, a, b;
        cin >> v >> u >> a >> b;
        g1[v].push_back({u, a});
        g1[u].push_back({v, a});
        g2[v].push_back({u, b});
        g2[u].push_back({v, b});
    }
    fill(A, A + n + 1, INF);
    fill(B, B + n + 1, INF);
    A[ss] = 0;
    B[tt] = 0;
    set<pll> s;
    s.insert({0, ss});
    while (s.size())
    {
        pll it = *s.begin();
        s.erase(s.begin());
        for (int i = 0; i < g1[it.second].size(); i++)
        {
            int u = g1[it.second][i].first;
            if (A[u] > A[it.second] + g1[it.second][i].second)
            {
                s.erase({A[u], u});
                A[u] = A[it.second] + g1[it.second][i].second;
                s.insert({A[u], u});
            }
        }
    }
    s.insert({0, tt});
    while (s.size())
    {
        pll it = *s.begin();
        s.erase(s.begin());
        for (int i = 0; i < g2[it.second].size(); i++)
        {
            int u = g2[it.second][i].first;
            if (B[u] > B[it.second] + g2[it.second][i].second)
            {
                s.erase({B[u], u});
                B[u] = B[it.second] + g2[it.second][i].second;
                s.insert({B[u], u});
            }
        }
    }
    vector<ll> ans;
    ll opt = INF - A[n] - B[n];
    for (int i = n - 1; i >= 0; i--)
    {
        ans.push_back(opt);
        opt = max(opt, INF - A[i] - B[i]);
    }
    reverse(all(ans));
    for (int i = 0; i < ans.size(); i++)
    {
        cout << ans[i] << "\n";
    }
    
}

Measured memory_bytes: 42900