

import heapq as hq



INF = 10**16

OKANE = 10**15







N, M, S, T = list(map(int, input().split()))



graph_yen = [[] for _ in range(N+1)]

graph_snk = [[] for _ in range(N+1)]





for i in range(M):

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

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

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

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

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



def dijkstra(st, graph, N):

    dist = [INF]*(N+1)

    hasVisited = [False]*(N+1)

    hasVisited[0] = True

    

    dist[st] = 0

    hasVisited[st] = True

    

    # startをpushする

    cand_list = []

    hq.heappush(cand_list, (0,st))

    while len(cand_list) != 0:

        nex, node = hq.heappop(cand_list)

        if dist[node] < nex:

            continue



        for nb in graph[node]:

            if dist[nb[1]] > nex+nb[0]:

                dist[nb[1]] = nex+nb[0]

                hq.heappush(cand_list,(dist[nb[1]], nb[1]))

    

    return dist





dist_yen = dijkstra(S,graph_yen, N)

dist_snk = dijkstra(T,graph_snk, N)



del dist_yen[0]

del dist_snk[0]





min_list = [INF]*(N+1)

i = 0

for yen, snk in zip(dist_yen[::-1], dist_snk[::-1]):

    i+=1

    min_after_i = yen+snk

    min_list[i] = min(min_after_i,min_list[i-1])



del min_list[0]



for cost in min_list[::-1]:

    print((OKANE - cost))
import sys

stdin = sys.stdin



sys.setrecursionlimit(10 ** 7)



def li(): return list(map(int, stdin.readline().split()))

def li_(): return [int(x) - 1 for x in stdin.readline().split()]

def lf(): return list(map(float, stdin.readline().split()))

def ls(): return stdin.readline().split()

def ns(): return stdin.readline().rstrip()

def lc(): return list(ns())

def ni(): return int(stdin.readline())

def nf(): return float(stdin.readline())





from heapq import heappush, heappop





def dijkstra(graph: list, start, INF=float('inf')) -> list:

    n = len(graph)

    dist = [INF] * n

    visited = [False] * n



    dist[start] = 0

    que = [(0, start)]



    while que:

        cost, cur = heappop(que)



        if visited[cur]:

            continue



        visited[cur] = True



        for nextnode, edgecost in graph[cur]:

            nextcost = cost + edgecost

            if nextcost < dist[nextnode]:

                dist[nextnode] = nextcost

                heappush(que, (nextcost, nextnode))



    return dist



n, m, s, t = li()

s -= 1

t -= 1



yen_graph = [[] for _ in range(n)]

snk_graph = [[] for _ in range(n)]



for _ in range(m):

    u, v, a, b = li()

    u -= 1

    v -= 1



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

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

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

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



yen_dist = dijkstra(yen_graph, s)

snk_dist = dijkstra(snk_graph, t)



initial = 10**15



ans = [-1]*n

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

    if i == n-1:

        ans[i] = initial - (yen_dist[i] + snk_dist[i])



    else:

        ans[i] = max(ans[i+1], initial - (yen_dist[i] + snk_dist[i]))



for ansi in ans:

    print(ansi)
import heapq as hq

INF = 10**16
OKANE = 10**15
N, M, S, T = list(map(int, input().split()))
graph_yen = [[] for _ in range(N + 1)]
graph_snk = [[] for _ in range(N + 1)]
for i in range(M):
    u, v, a, b = list(map(int, input().split()))
    graph_yen[u].append((a, v))
    graph_yen[v].append((a, u))
    graph_snk[u].append((b, v))
    graph_snk[v].append((b, u))


def dijkstra(st, graph, N):
    dist = [INF] * (N + 1)
    hasVisited = [False] * (N + 1)
    hasVisited[0] = True
    dist[st] = 0
    hasVisited[st] = True
    # startをpushする
    cand_list = []
    hq.heappush(cand_list, (0, st))
    while len(cand_list) != 0:
        nex, node = hq.heappop(cand_list)
        if dist[node] < nex:
            continue
        for nb in graph[node]:
            if dist[nb[1]] > nex + nb[0]:
                dist[nb[1]] = nex + nb[0]
                hq.heappush(cand_list, (dist[nb[1]], nb[1]))
    return dist


dist_yen = dijkstra(S, graph_yen, N)
dist_snk = dijkstra(T, graph_snk, N)
del dist_yen[0]
del dist_snk[0]
min_list = [INF] * (N + 1)
i = 0
for yen, snk in zip(dist_yen[::-1], dist_snk[::-1]):
    i += 1
    min_after_i = yen + snk
    min_list[i] = min(min_after_i, min_list[i - 1])
del min_list[0]
for cost in min_list[::-1]:
    print((OKANE - cost))

import sys

stdin = sys.stdin
sys.setrecursionlimit(10**7)


def li():
    return list(map(int, stdin.readline().split()))


def li_():
    return [int(x) - 1 for x in stdin.readline().split()]


def lf():
    return list(map(float, stdin.readline().split()))


def ls():
    return stdin.readline().split()


def ns():
    return stdin.readline().rstrip()


def lc():
    return list(ns())


def ni():
    return int(stdin.readline())


def nf():
    return float(stdin.readline())


from heapq import heappush, heappop


def dijkstra(graph: list, start, INF=float("inf")) -> list:
    n = len(graph)
    dist = [INF] * n
    visited = [False] * n
    dist[start] = 0
    que = [(0, start)]
    while que:
        cost, cur = heappop(que)
        if visited[cur]:
            continue
        visited[cur] = True
        for nextnode, edgecost in graph[cur]:
            nextcost = cost + edgecost
            if nextcost < dist[nextnode]:
                dist[nextnode] = nextcost
                heappush(que, (nextcost, nextnode))
    return dist


n, m, s, t = li()
s -= 1
t -= 1
yen_graph = [[] for _ in range(n)]
snk_graph = [[] for _ in range(n)]
for _ in range(m):
    u, v, a, b = li()
    u -= 1
    v -= 1
    yen_graph[u].append((v, a))
    yen_graph[v].append((u, a))
    snk_graph[u].append((v, b))
    snk_graph[v].append((u, b))
yen_dist = dijkstra(yen_graph, s)
snk_dist = dijkstra(snk_graph, t)
initial = 10**15
ans = [-1] * n
for i in range(n - 1, -1, -1):
    if i == n - 1:
        ans[i] = initial - (yen_dist[i] + snk_dist[i])
    else:
        ans[i] = max(ans[i + 1], initial - (yen_dist[i] + snk_dist[i]))
for ansi in ans:
    print(ansi)

-import heapq as hq +import sys -INF = 10**16 -OKANE = 10**15 -N, M, S, T = list(map(int, input().split())) -graph_yen = [[] for _ in range(N + 1)] -graph_snk = [[] for _ in range(N + 1)] -for i in range(M): -    u, v, a, b = list(map(int, input().split())) -    graph_yen[u].append((a, v)) -    graph_yen[v].append((a, u)) -    graph_snk[u].append((b, v)) -    graph_snk[v].append((b, u)) +stdin = sys.stdin +sys.setrecursionlimit(10**7) -def dijkstra(st, graph, N): -    dist = [INF] * (N + 1) -    hasVisited = [False] * (N + 1) -    hasVisited[0] = True -    dist[st] = 0 -    hasVisited[st] = True -    # startをpushする -    cand_list = [] -    hq.heappush(cand_list, (0, st)) -    while len(cand_list) != 0: -        nex, node = hq.heappop(cand_list) -        if dist[node] < nex: +def li(): +    return list(map(int, stdin.readline().split())) + + +def li_(): +    return [int(x) - 1 for x in stdin.readline().split()] + + +def lf(): +    return list(map(float, stdin.readline().split())) + + +def ls(): +    return stdin.readline().split() + + +def ns(): +    return stdin.readline().rstrip() + + +def lc(): +    return list(ns()) + + +def ni(): +    return int(stdin.readline()) + + +def nf(): +    return float(stdin.readline()) + + +from heapq import heappush, heappop + + +def dijkstra(graph: list, start, INF=float("inf")) -> list: +    n = len(graph) +    dist = [INF] * n +    visited = [False] * n +    dist[start] = 0 +    que = [(0, start)] +    while que: +        cost, cur = heappop(que) +        if visited[cur]: -        for nb in graph[node]: -            if dist[nb[1]] > nex + nb[0]: -                dist[nb[1]] = nex + nb[0] -                hq.heappush(cand_list, (dist[nb[1]], nb[1])) +        visited[cur] = True +        for nextnode, edgecost in graph[cur]: +            nextcost = cost + edgecost +            if nextcost < dist[nextnode]: +                dist[nextnode] = nextcost +                heappush(que, (nextcost, nextnode)) -dist_yen = dijkstra(S, graph_yen, N) -dist_snk = dijkstra(T, graph_snk, N) -del dist_yen[0] -del dist_snk[0] -min_list = [INF] * (N + 1) -i = 0 -for yen, snk in zip(dist_yen[::-1], dist_snk[::-1]): -    i += 1 -    min_after_i = yen + snk -    min_list[i] = min(min_after_i, min_list[i - 1]) -del min_list[0] -for cost in min_list[::-1]: -    print((OKANE - cost)) +n, m, s, t = li() +s -= 1 +t -= 1 +yen_graph = [[] for _ in range(n)] +snk_graph = [[] for _ in range(n)] +for _ in range(m): +    u, v, a, b = li() +    u -= 1 +    v -= 1 +    yen_graph[u].append((v, a)) +    yen_graph[v].append((u, a)) +    snk_graph[u].append((v, b)) +    snk_graph[v].append((u, b)) +yen_dist = dijkstra(yen_graph, s) +snk_dist = dijkstra(snk_graph, t) +initial = 10**15 +ans = [-1] * n +for i in range(n - 1, -1, -1): +    if i == n - 1: +        ans[i] = initial - (yen_dist[i] + snk_dist[i]) +    else: +        ans[i] = max(ans[i + 1], initial - (yen_dist[i] + snk_dist[i])) +for ansi in ans: +    print(ansi)