import heapq

import sys



input = sys.stdin.readline

INF = 10**18



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

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



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

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



for e in edge:

    graph_s[e[0]-1].append([e[1]-1,e[2]])

    graph_s[e[1]-1].append([e[0]-1,e[2]])

    graph_t[e[0]-1].append([e[1]-1,e[3]])

    graph_t[e[1]-1].append([e[0]-1,e[3]])



dist_s = [INF]*n

dist_t = [INF]*n



dist_s[s-1] = 0

dist_t[t-1] = 0



heap_s = [[0,s-1]]

heapq.heapify(heap_s)



heap_t = [[0,t-1]]

heapq.heapify(heap_t)



while heap_s:

    cost,node = heapq.heappop(heap_s)

    if dist_s[node] < cost:

        continue

    for adj,adjcost in graph_s[node]:

        if dist_s[node] + adjcost < dist_s[adj]:

            dist_s[adj] = dist_s[node] + adjcost

            heapq.heappush(heap_s,[dist_s[adj],adj])



while heap_t:

    cost,node = heapq.heappop(heap_t)

    if dist_t[node] < cost:

        continue

    for adj,adjcost in graph_t[node]:

        if dist_t[node] + adjcost < dist_t[adj]:

            dist_t[adj] = dist_t[node] + adjcost

            heapq.heappush(heap_t,[dist_t[adj],adj])



dist = INF

ans = []

                                              

for i in range(n):

    dist = min(dist,dist_t[-1-i]+dist_s[-1-i])

    ans.append(10**15-dist)

    

for i in range(n):

    print((ans[-1-i]))
from heapq import heappop, heappush, heapify



class Graph():  #non-directed

    def __init__(self, n, edge, indexed=1):

        self.n = n

        self.edge = edge

        self.indexed = indexed

        self.graph = [[] for _ in range(n)]

        for e in edge:

            self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))

            self.graph[e[1] - indexed].append((e[0] - indexed, e[2]))



    def dijkstra(self, s, INF=10**18, restore_to=None):

        dist = [INF for _ in range(self.n)]

        dist[s] = 0

        heap = [(0, s)]

        prev = [None for _ in range(self.n)]

        while heap:

            cost, node = heappop(heap)

            if dist[node] < cost:

                continue

            for adj, adjcost in self.graph[node]:

                if dist[node] + adjcost < dist[adj]:

                    dist[adj] = dist[node] + adjcost

                    prev[adj] = node

                    heappush(heap, (dist[adj], adj))

        if restore_to is not None:

            g = restore_to

            if dist[g] == INF:

                return dist, False

            path = [g]

            node = g

            while node != s:

                node = prev[node]

                path.append(node)

            return dist, path[::-1]

        return dist



import sys

input = sys.stdin.readline



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



E1 = []

E2 = []



for _ in range(M):

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

    E1.append((u, v, a))

    E2.append((u, v, b))

    

g1 = Graph(N, E1)

g2 = Graph(N, E2)

dist_from_s = g1.dijkstra(S - 1)

dist_from_t = g2.dijkstra(T - 1)



res = list()

tmp = 0



for i in range(N)[::-1]:

    tmp = max(tmp, 10**15 - dist_from_t[i] - dist_from_s[i])

    res.append(tmp)

    

print(('\n'.join(map(str, res[::-1]))))
import heapq
import sys

input = sys.stdin.readline
INF = 10**18
n, m, s, t = list(map(int, input().split()))
edge = [list(map(int, input().split())) for _ in range(m)]
graph_s = [[] for _ in range(n)]
graph_t = [[] for _ in range(n)]
for e in edge:
    graph_s[e[0] - 1].append([e[1] - 1, e[2]])
    graph_s[e[1] - 1].append([e[0] - 1, e[2]])
    graph_t[e[0] - 1].append([e[1] - 1, e[3]])
    graph_t[e[1] - 1].append([e[0] - 1, e[3]])
dist_s = [INF] * n
dist_t = [INF] * n
dist_s[s - 1] = 0
dist_t[t - 1] = 0
heap_s = [[0, s - 1]]
heapq.heapify(heap_s)
heap_t = [[0, t - 1]]
heapq.heapify(heap_t)
while heap_s:
    cost, node = heapq.heappop(heap_s)
    if dist_s[node] < cost:
        continue
    for adj, adjcost in graph_s[node]:
        if dist_s[node] + adjcost < dist_s[adj]:
            dist_s[adj] = dist_s[node] + adjcost
            heapq.heappush(heap_s, [dist_s[adj], adj])
while heap_t:
    cost, node = heapq.heappop(heap_t)
    if dist_t[node] < cost:
        continue
    for adj, adjcost in graph_t[node]:
        if dist_t[node] + adjcost < dist_t[adj]:
            dist_t[adj] = dist_t[node] + adjcost
            heapq.heappush(heap_t, [dist_t[adj], adj])
dist = INF
ans = []
for i in range(n):
    dist = min(dist, dist_t[-1 - i] + dist_s[-1 - i])
    ans.append(10**15 - dist)
for i in range(n):
    print((ans[-1 - i]))

from heapq import heappop, heappush, heapify


class Graph:  # non-directed
    def __init__(self, n, edge, indexed=1):
        self.n = n
        self.edge = edge
        self.indexed = indexed
        self.graph = [[] for _ in range(n)]
        for e in edge:
            self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))
            self.graph[e[1] - indexed].append((e[0] - indexed, e[2]))

    def dijkstra(self, s, INF=10**18, restore_to=None):
        dist = [INF for _ in range(self.n)]
        dist[s] = 0
        heap = [(0, s)]
        prev = [None for _ in range(self.n)]
        while heap:
            cost, node = heappop(heap)
            if dist[node] < cost:
                continue
            for adj, adjcost in self.graph[node]:
                if dist[node] + adjcost < dist[adj]:
                    dist[adj] = dist[node] + adjcost
                    prev[adj] = node
                    heappush(heap, (dist[adj], adj))
        if restore_to is not None:
            g = restore_to
            if dist[g] == INF:
                return dist, False
            path = [g]
            node = g
            while node != s:
                node = prev[node]
                path.append(node)
            return dist, path[::-1]
        return dist


import sys

input = sys.stdin.readline
N, M, S, T = list(map(int, input().split()))
E1 = []
E2 = []
for _ in range(M):
    u, v, a, b = list(map(int, input().split()))
    E1.append((u, v, a))
    E2.append((u, v, b))
g1 = Graph(N, E1)
g2 = Graph(N, E2)
dist_from_s = g1.dijkstra(S - 1)
dist_from_t = g2.dijkstra(T - 1)
res = list()
tmp = 0
for i in range(N)[::-1]:
    tmp = max(tmp, 10**15 - dist_from_t[i] - dist_from_s[i])
    res.append(tmp)
print(("\n".join(map(str, res[::-1]))))

-import heapq +from heapq import heappop, heappush, heapify + + +class Graph:  # non-directed +    def __init__(self, n, edge, indexed=1): +        self.n = n +        self.edge = edge +        self.indexed = indexed +        self.graph = [[] for _ in range(n)] +        for e in edge: +            self.graph[e[0] - indexed].append((e[1] - indexed, e[2])) +            self.graph[e[1] - indexed].append((e[0] - indexed, e[2])) + +    def dijkstra(self, s, INF=10**18, restore_to=None): +        dist = [INF for _ in range(self.n)] +        dist[s] = 0 +        heap = [(0, s)] +        prev = [None for _ in range(self.n)] +        while heap: +            cost, node = heappop(heap) +            if dist[node] < cost: +                continue +            for adj, adjcost in self.graph[node]: +                if dist[node] + adjcost < dist[adj]: +                    dist[adj] = dist[node] + adjcost +                    prev[adj] = node +                    heappush(heap, (dist[adj], adj)) +        if restore_to is not None: +            g = restore_to +            if dist[g] == INF: +                return dist, False +            path = [g] +            node = g +            while node != s: +                node = prev[node] +                path.append(node) +            return dist, path[::-1] +        return dist + + -INF = 10**18 -n, m, s, t = list(map(int, input().split())) -edge = [list(map(int, input().split())) for _ in range(m)] -graph_s = [[] for _ in range(n)] -graph_t = [[] for _ in range(n)] -for e in edge: -    graph_s[e[0] - 1].append([e[1] - 1, e[2]]) -    graph_s[e[1] - 1].append([e[0] - 1, e[2]]) -    graph_t[e[0] - 1].append([e[1] - 1, e[3]]) -    graph_t[e[1] - 1].append([e[0] - 1, e[3]]) -dist_s = [INF] * n -dist_t = [INF] * n -dist_s[s - 1] = 0 -dist_t[t - 1] = 0 -heap_s = [[0, s - 1]] -heapq.heapify(heap_s) -heap_t = [[0, t - 1]] -heapq.heapify(heap_t) -while heap_s: -    cost, node = heapq.heappop(heap_s) -    if dist_s[node] < cost: -        continue -    for adj, adjcost in graph_s[node]: -        if dist_s[node] + adjcost < dist_s[adj]: -            dist_s[adj] = dist_s[node] + adjcost -            heapq.heappush(heap_s, [dist_s[adj], adj]) -while heap_t: -    cost, node = heapq.heappop(heap_t) -    if dist_t[node] < cost: -        continue -    for adj, adjcost in graph_t[node]: -        if dist_t[node] + adjcost < dist_t[adj]: -            dist_t[adj] = dist_t[node] + adjcost -            heapq.heappush(heap_t, [dist_t[adj], adj]) -dist = INF -ans = [] -for i in range(n): -    dist = min(dist, dist_t[-1 - i] + dist_s[-1 - i]) -    ans.append(10**15 - dist) -for i in range(n): -    print((ans[-1 - i])) +N, M, S, T = list(map(int, input().split())) +E1 = [] +E2 = [] +for _ in range(M): +    u, v, a, b = list(map(int, input().split())) +    E1.append((u, v, a)) +    E2.append((u, v, b)) +g1 = Graph(N, E1) +g2 = Graph(N, E2) +dist_from_s = g1.dijkstra(S - 1) +dist_from_t = g2.dijkstra(T - 1) +res = list() +tmp = 0 +for i in range(N)[::-1]: +    tmp = max(tmp, 10**15 - dist_from_t[i] - dist_from_s[i]) +    res.append(tmp) +print(("\n".join(map(str, res[::-1]))))