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

uvab = [list(map(int,input().split())) for i in range(m)]

gyen = [[] for i in range(n+1)]

gsnu = [[] for i in range(n+1)]

for u,v,a,b in uvab:

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

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

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

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

import heapq as hq

def dijkstra(start,graph):

  dist = [10**18]*(n+1)

  dist[start] = 0

  q = [(0,start)]

  hq.heapify(q)

  while q:

    _,x = hq.heappop(q)

    for y,dd in graph[x]:

      if dist[y] > dist[x]+dd:

        dist[y] = dist[x]+dd

        hq.heappush(q,(dist[y],y))

  return dist

distyen = dijkstra(s,gyen)

distsnu = dijkstra(t,gsnu)

ans = []

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

  x = 10**15-(distyen[i]+distsnu[i])

  if i == n:

    ans.append(x)

  else:

    ans.append(max(ans[-1],x))

ans = ans[::-1]

print(*ans,sep="\n")

import sys

input = sys.stdin.readline

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

uvab = [list(map(int,input().split())) for i in range(m)]

gyen = [[] for i in range(n+1)]

gsnu = [[] for i in range(n+1)]

for u,v,a,b in uvab:

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

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

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

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

import heapq as hq

def dijkstra(start,graph):

  dist = [10**18]*(n+1)

  dist[start] = 0

  q = [(0,start)]

  hq.heapify(q)

  while q:

    _,x = hq.heappop(q)

    for y,dd in graph[x]:

      if dist[y] > dist[x]+dd:

        dist[y] = dist[x]+dd

        hq.heappush(q,(dist[y],y))

  return dist

distyen = dijkstra(s,gyen)

distsnu = dijkstra(t,gsnu)

ans = []

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

  x = 10**15-(distyen[i]+distsnu[i])

  if i == n:

    ans.append(x)

  else:

    ans.append(max(ans[-1],x))

ans = ans[::-1]

print(*ans,sep="\n")

n, m, s, t = map(int, input().split())
uvab = [list(map(int, input().split())) for i in range(m)]
gyen = [[] for i in range(n + 1)]
gsnu = [[] for i in range(n + 1)]
for u, v, a, b in uvab:
    gyen[u].append((v, a))
    gyen[v].append((u, a))
    gsnu[u].append((v, b))
    gsnu[v].append((u, b))
import heapq as hq


def dijkstra(start, graph):
    dist = [10**18] * (n + 1)
    dist[start] = 0
    q = [(0, start)]
    hq.heapify(q)
    while q:
        _, x = hq.heappop(q)
        for y, dd in graph[x]:
            if dist[y] > dist[x] + dd:
                dist[y] = dist[x] + dd
                hq.heappush(q, (dist[y], y))
    return dist


distyen = dijkstra(s, gyen)
distsnu = dijkstra(t, gsnu)
ans = []
for i in range(n, 0, -1):
    x = 10**15 - (distyen[i] + distsnu[i])
    if i == n:
        ans.append(x)
    else:
        ans.append(max(ans[-1], x))
ans = ans[::-1]
print(*ans, sep="\n")

import sys

input = sys.stdin.readline
n, m, s, t = map(int, input().split())
uvab = [list(map(int, input().split())) for i in range(m)]
gyen = [[] for i in range(n + 1)]
gsnu = [[] for i in range(n + 1)]
for u, v, a, b in uvab:
    gyen[u].append((v, a))
    gyen[v].append((u, a))
    gsnu[u].append((v, b))
    gsnu[v].append((u, b))
import heapq as hq


def dijkstra(start, graph):
    dist = [10**18] * (n + 1)
    dist[start] = 0
    q = [(0, start)]
    hq.heapify(q)
    while q:
        _, x = hq.heappop(q)
        for y, dd in graph[x]:
            if dist[y] > dist[x] + dd:
                dist[y] = dist[x] + dd
                hq.heappush(q, (dist[y], y))
    return dist


distyen = dijkstra(s, gyen)
distsnu = dijkstra(t, gsnu)
ans = []
for i in range(n, 0, -1):
    x = 10**15 - (distyen[i] + distsnu[i])
    if i == n:
        ans.append(x)
    else:
        ans.append(max(ans[-1], x))
ans = ans[::-1]
print(*ans, sep="\n")

+import sys + +input = sys.stdin.readline