#include <bits/stdc++.h>
using namespace std;

template<typename T> class Dijkstra {
public:
  struct edge {
    int to; T cost;
  };
  int V;
  vector<vector<edge>> G;
  vector<T> dist;
  using pti = pair<T,int>;
  Dijkstra(int n) : V(n), G(V), dist(V, numeric_limits<T>::max()) {}
  void add(int u, int v, T cost) {
    G.at(u).push_back((edge) {v, cost});
    G.at(v).push_back((edge) {u, cost});
  }
  void solve(int s) {
    priority_queue<pti, vector<pti>, greater<pti>> Q;
    dist.at(s) = 0;
    Q.push(pti(0, s));
    while (!Q.empty()) {
      pti p = Q.top();
      Q.pop();
      int v = p.second;
      if (dist.at(v) < p.first) continue;
      for (auto &w : G.at(v)) {
        if (dist.at(w.to) > dist.at(v) + w.cost) {
          dist.at(w.to) = dist.at(v) + w.cost;
          Q.push(pti(dist.at(w.to), w.to));
        }
      }
    }
  }
};

int main() {
  int N, M, S, G;
  cin >> N >> M >> S >> G;
  Dijkstra<long> D(N), D2(N);
  for (int i = 0; i < M; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    D.add(--a, --b, c);
    D2.add(a, b, d);
  }
  D.solve(--S);
  D2.solve(--G);
  vector<long> sum(N);
  for (int i = 0; i < N; i++) {
    sum.at(i) = D.dist.at(i) + D2.dist.at(i);
  }
  for (long i = N - 1, mi = LONG_MAX; i >= 0; i--) {
    sum.at(i) = (mi = min(mi, sum.at(i)));
  }
  for (int i = 0; i < N; i++) {
    cout << (long) 1e15 - sum.at(i) << "\n";
  }
}