import heapq

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

src = [tuple(map(int,input().split())) for i in range(M)]

S,T = S-1,T-1



INF = float('inf')

def dijkstra(is_yen):

    g = [[] for i in range(N)]

    for u,v,a,b in src:

        u,v = u-1,v-1

        c = a if is_yen else b

        g[u].append((v,c))

        g[v].append((u,c))

    costs = [INF] * N

    start = S if is_yen else T

    costs[start] = 0

    hq = [(0,start)]

    heapq.heapify(hq)

    while hq:

        _,v = heapq.heappop(hq)

        for to,c in g[v]:

            if costs[v]+c >= costs[to]: continue

            costs[to] = costs[v]+c

            heapq.heappush(hq, (costs[to],to))

    return costs



yens = dijkstra(1)

snuuks = dijkstra(0)



ans = [None] * N

ans[-1] = yens[-1] + snuuks[-1]

for i in reversed(list(range(N-1))):

    ans[i] = min(ans[i+1], yens[i]+snuuks[i])



for a in ans:

    print((10**15 - a))
N,M,S,T = map(int,input().split())

S,T = S-1,T-1

UVAB = [tuple(map(int,input().split())) for i in range(M)]

es = [[] for _ in range(N)]

for u,v,a,b in UVAB:

    u,v = u-1,v-1

    es[u].append((v,a,b))

    es[v].append((u,a,b))



import heapq

INF = float('inf')

ycost = [INF] * N

ycost[S] = 0

q = [(0,S)]

heapq.heapify(q)

while q:

    c,v = heapq.heappop(q)

    for to,a,b in es[v]:

        if c+a >= ycost[to]: continue

        ycost[to] = c+a

        heapq.heappush(q, (c+a,to))



scost = [INF] * N

scost[T] = 0

q = [(0,T)]

heapq.heapify(q)

while q:

    c,v = heapq.heappop(q)

    for to,a,b in es[v]:

        if c+b >= scost[to]: continue

        scost[to] = c+b

        heapq.heappush(q, (c+b,to))



a = 0

ans = []

for y,s in zip(ycost[::-1],scost[::-1]):

    tmp = 10**15 -y -s

    a = max(a, tmp)

    ans.append(a)

print(*ans[::-1], sep='\n')

import heapq

N, M, S, T = list(map(int, input().split()))
src = [tuple(map(int, input().split())) for i in range(M)]
S, T = S - 1, T - 1
INF = float("inf")


def dijkstra(is_yen):
    g = [[] for i in range(N)]
    for u, v, a, b in src:
        u, v = u - 1, v - 1
        c = a if is_yen else b
        g[u].append((v, c))
        g[v].append((u, c))
    costs = [INF] * N
    start = S if is_yen else T
    costs[start] = 0
    hq = [(0, start)]
    heapq.heapify(hq)
    while hq:
        _, v = heapq.heappop(hq)
        for to, c in g[v]:
            if costs[v] + c >= costs[to]:
                continue
            costs[to] = costs[v] + c
            heapq.heappush(hq, (costs[to], to))
    return costs


yens = dijkstra(1)
snuuks = dijkstra(0)
ans = [None] * N
ans[-1] = yens[-1] + snuuks[-1]
for i in reversed(list(range(N - 1))):
    ans[i] = min(ans[i + 1], yens[i] + snuuks[i])
for a in ans:
    print((10**15 - a))

N, M, S, T = map(int, input().split())
S, T = S - 1, T - 1
UVAB = [tuple(map(int, input().split())) for i in range(M)]
es = [[] for _ in range(N)]
for u, v, a, b in UVAB:
    u, v = u - 1, v - 1
    es[u].append((v, a, b))
    es[v].append((u, a, b))
import heapq

INF = float("inf")
ycost = [INF] * N
ycost[S] = 0
q = [(0, S)]
heapq.heapify(q)
while q:
    c, v = heapq.heappop(q)
    for to, a, b in es[v]:
        if c + a >= ycost[to]:
            continue
        ycost[to] = c + a
        heapq.heappush(q, (c + a, to))
scost = [INF] * N
scost[T] = 0
q = [(0, T)]
heapq.heapify(q)
while q:
    c, v = heapq.heappop(q)
    for to, a, b in es[v]:
        if c + b >= scost[to]:
            continue
        scost[to] = c + b
        heapq.heappush(q, (c + b, to))
a = 0
ans = []
for y, s in zip(ycost[::-1], scost[::-1]):
    tmp = 10**15 - y - s
    a = max(a, tmp)
    ans.append(a)
print(*ans[::-1], sep="\n")

+N, M, S, T = map(int, input().split()) +S, T = S - 1, T - 1 +UVAB = [tuple(map(int, input().split())) for i in range(M)] +es = [[] for _ in range(N)] +for u, v, a, b in UVAB: +    u, v = u - 1, v - 1 +    es[u].append((v, a, b)) +    es[v].append((u, a, b)) -N, M, S, T = list(map(int, input().split())) -src = [tuple(map(int, input().split())) for i in range(M)] -S, T = S - 1, T - 1 - - -def dijkstra(is_yen): -    g = [[] for i in range(N)] -    for u, v, a, b in src: -        u, v = u - 1, v - 1 -        c = a if is_yen else b -        g[u].append((v, c)) -        g[v].append((u, c)) -    costs = [INF] * N -    start = S if is_yen else T -    costs[start] = 0 -    hq = [(0, start)] -    heapq.heapify(hq) -    while hq: -        _, v = heapq.heappop(hq) -        for to, c in g[v]: -            if costs[v] + c >= costs[to]: -                continue -            costs[to] = costs[v] + c -            heapq.heappush(hq, (costs[to], to)) -    return costs - - -yens = dijkstra(1) -snuuks = dijkstra(0) -ans = [None] * N -ans[-1] = yens[-1] + snuuks[-1] -for i in reversed(list(range(N - 1))): -    ans[i] = min(ans[i + 1], yens[i] + snuuks[i]) -for a in ans: -    print((10**15 - a)) +ycost = [INF] * N +ycost[S] = 0 +q = [(0, S)] +heapq.heapify(q) +while q: +    c, v = heapq.heappop(q) +    for to, a, b in es[v]: +        if c + a >= ycost[to]: +            continue +        ycost[to] = c + a +        heapq.heappush(q, (c + a, to)) +scost = [INF] * N +scost[T] = 0 +q = [(0, T)] +heapq.heapify(q) +while q: +    c, v = heapq.heappop(q) +    for to, a, b in es[v]: +        if c + b >= scost[to]: +            continue +        scost[to] = c + b +        heapq.heappush(q, (c + b, to)) +a = 0 +ans = [] +for y, s in zip(ycost[::-1], scost[::-1]): +    tmp = 10**15 - y - s +    a = max(a, tmp) +    ans.append(a) +print(*ans[::-1], sep="\n")