import sys

from collections import defaultdict as dd

import heapq

input = sys.stdin.readline

n, m, s, t = list(map(int, input().split()))

e = dd(list)

money = 10 ** 15

for _ in range(m):

  u, v, a, b = list(map(int, input().split()))

  e[u].append((v, a))

  e[v].append((u, a))

  e[u + n].append((v + n, b))

  e[v + n].append((u + n, b))

"""

for i in range(1, n + 1):

  e[i].append((i + n, 0))

"""

class dijkstra:

  def __init__(self, n, e):

    self.e = e

    self.n = n

  def path(self, s, t):

    d = [float("inf")] * (self.n + 1)

    vis = set()

    d[s] = 0

    h = [s]

    while not t in vis and len(h):

      v = heapq.heappop(h)

      v1 = v % (10 ** 15)

      v0 = v // (10 ** 15)

      if v1 in vis: continue

      vis.add(v1)

      for p in self.e[v1]:

        d[p[0]] = min(d[p[0]], d[v1] + p[1])

        if p[0] in vis: continue

        heapq.heappush(h, d[p[0]] * (10 ** 15) + p[0])

    return d

d = dijkstra(2 * n + 1, e)

x = d.path(s, 2 * n + 1)

y = d.path(t + n, 2 * n + 1)

#print(x)

#print(y)

paths = [float("inf")] * (n + 1)

minpaths = [float("inf")] * (n + 1)

for i in range(1, n + 1):

  paths[i] = x[i] + y[n + i]

#print(paths)

minpaths[-1] = paths[-1]

for i in range(n - 1, -1, -1):

  minpaths[i] = min(minpaths[i + 1], paths[i])

#print(minpaths)

for i in range(1, n + 1):

  print((money - minpaths[i]))
import sys

from collections import defaultdict as dd

input = sys.stdin.readline

N, M, s, t = list(map(int, input().split()))

e = dd(list)

ee = dd(list)

for i in range(M):

  u, v, a, b = list(map(int, input().split()))

  e[u].append((v, a))

  e[v].append((u, a))

  ee[u].append((v, b))

  ee[v].append((u, b))



import heapq

class dijkstra:

  def __init__(self, n, e):

    self.e = e

    self.n = n

  def path(self, s, t):

    d = [float("inf")] * (self.n + 1)

    vis = set()

    d[s] = 0

    h = [s]

    while not t in vis and len(h):

      v = heapq.heappop(h)

      v1 = v % (10 ** 10)

      v0 = v // (10 ** 10)

      if v1 in vis: continue

      vis.add(v1)

      for p in self.e[v1]:

        d[p[0]] = min(d[p[0]], d[v1] + p[1])

        if p[0] in vis: continue

        heapq.heappush(h, d[p[0]] * (10 ** 10) + p[0])

    return d

dij = dijkstra(N, e)

edij = dijkstra(N, ee)

p = dij.path(s, 0)

revp = edij.path(t, 0)

mny = pow(10, 15)

table = [0] * (N + 1)

for x in range(1, N + 1):

  table[x] = mny - p[x] - revp[x]

csmx = [0] * (N + 1)



for i in range(N, 0, -1): csmx[i - 1] = max(csmx[i - 1], table[i], csmx[i])

for i in range(N): print((csmx[i]))
import sys
from collections import defaultdict as dd
import heapq

input = sys.stdin.readline
n, m, s, t = list(map(int, input().split()))
e = dd(list)
money = 10**15
for _ in range(m):
    u, v, a, b = list(map(int, input().split()))
    e[u].append((v, a))
    e[v].append((u, a))
    e[u + n].append((v + n, b))
    e[v + n].append((u + n, b))
"""
for i in range(1, n + 1):
  e[i].append((i + n, 0))
"""


class dijkstra:
    def __init__(self, n, e):
        self.e = e
        self.n = n

    def path(self, s, t):
        d = [float("inf")] * (self.n + 1)
        vis = set()
        d[s] = 0
        h = [s]
        while not t in vis and len(h):
            v = heapq.heappop(h)
            v1 = v % (10**15)
            v0 = v // (10**15)
            if v1 in vis:
                continue
            vis.add(v1)
            for p in self.e[v1]:
                d[p[0]] = min(d[p[0]], d[v1] + p[1])
                if p[0] in vis:
                    continue
                heapq.heappush(h, d[p[0]] * (10**15) + p[0])
        return d


d = dijkstra(2 * n + 1, e)
x = d.path(s, 2 * n + 1)
y = d.path(t + n, 2 * n + 1)
# print(x)
# print(y)
paths = [float("inf")] * (n + 1)
minpaths = [float("inf")] * (n + 1)
for i in range(1, n + 1):
    paths[i] = x[i] + y[n + i]
# print(paths)
minpaths[-1] = paths[-1]
for i in range(n - 1, -1, -1):
    minpaths[i] = min(minpaths[i + 1], paths[i])
# print(minpaths)
for i in range(1, n + 1):
    print((money - minpaths[i]))

import sys
from collections import defaultdict as dd

input = sys.stdin.readline
N, M, s, t = list(map(int, input().split()))
e = dd(list)
ee = dd(list)
for i in range(M):
    u, v, a, b = list(map(int, input().split()))
    e[u].append((v, a))
    e[v].append((u, a))
    ee[u].append((v, b))
    ee[v].append((u, b))
import heapq


class dijkstra:
    def __init__(self, n, e):
        self.e = e
        self.n = n

    def path(self, s, t):
        d = [float("inf")] * (self.n + 1)
        vis = set()
        d[s] = 0
        h = [s]
        while not t in vis and len(h):
            v = heapq.heappop(h)
            v1 = v % (10**10)
            v0 = v // (10**10)
            if v1 in vis:
                continue
            vis.add(v1)
            for p in self.e[v1]:
                d[p[0]] = min(d[p[0]], d[v1] + p[1])
                if p[0] in vis:
                    continue
                heapq.heappush(h, d[p[0]] * (10**10) + p[0])
        return d


dij = dijkstra(N, e)
edij = dijkstra(N, ee)
p = dij.path(s, 0)
revp = edij.path(t, 0)
mny = pow(10, 15)
table = [0] * (N + 1)
for x in range(1, N + 1):
    table[x] = mny - p[x] - revp[x]
csmx = [0] * (N + 1)
for i in range(N, 0, -1):
    csmx[i - 1] = max(csmx[i - 1], table[i], csmx[i])
for i in range(N):
    print((csmx[i]))

-import heapq -n, m, s, t = list(map(int, input().split())) +N, M, s, t = list(map(int, input().split())) -money = 10**15 -for _ in range(m): +ee = dd(list) +for i in range(M): -    e[u + n].append((v + n, b)) -    e[v + n].append((u + n, b)) -""" -for i in range(1, n + 1): -  e[i].append((i + n, 0)) -""" +    ee[u].append((v, b)) +    ee[v].append((u, b)) +import heapq -            v1 = v % (10**15) -            v0 = v // (10**15) +            v1 = v % (10**10) +            v0 = v // (10**10) -                heapq.heappush(h, d[p[0]] * (10**15) + p[0]) +                heapq.heappush(h, d[p[0]] * (10**10) + p[0]) -d = dijkstra(2 * n + 1, e) -x = d.path(s, 2 * n + 1) -y = d.path(t + n, 2 * n + 1) -# print(x) -# print(y) -paths = [float("inf")] * (n + 1) -minpaths = [float("inf")] * (n + 1) -for i in range(1, n + 1): -    paths[i] = x[i] + y[n + i] -# print(paths) -minpaths[-1] = paths[-1] -for i in range(n - 1, -1, -1): -    minpaths[i] = min(minpaths[i + 1], paths[i]) -# print(minpaths) -for i in range(1, n + 1): -    print((money - minpaths[i])) +dij = dijkstra(N, e) +edij = dijkstra(N, ee) +p = dij.path(s, 0) +revp = edij.path(t, 0) +mny = pow(10, 15) +table = [0] * (N + 1) +for x in range(1, N + 1): +    table[x] = mny - p[x] - revp[x] +csmx = [0] * (N + 1) +for i in range(N, 0, -1): +    csmx[i - 1] = max(csmx[i - 1], table[i], csmx[i]) +for i in range(N): +    print((csmx[i]))