Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappop, heappush
INF = float('inf')

n, m, s, t = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(m)]

graph = [[] for _ in range(n + 1)]
for u, v, a, b in edges:
    graph[u].append((v, a, b))
    graph[v].append((u, a, b))

def dijkstra(s, pay):
    """
    s: start
    pay: 0 = yen, 1 = snuuk
    """
    d = [INF] * (n + 1)
    visited = [False] * (n + 1)
    pq = []

    heappush(pq, (0, s))
    d[s] = 0
    visited[s] = True

    while pq:
        cost, x = heappop(pq)
        visited[x] = True

        for v, *c in graph[x]:
            if visited[v]:
                continue

            if d[v] > d[x] + c[pay]:
                d[v] = d[x] + c[pay]
                heappush(pq, (d[v], v))

    return d

d1 = dijkstra(s, 0)
d2 = dijkstra(t, 1)

cost = [v + w for v, w in zip(d1[1:], d2[1:])]
for i in range(n):
    print(10 ** 15 - min(cost[i:]))








Fixed submission:
from heapq import heappop, heappush
INF = float('inf')

n, m, s, t = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(m)]

graph = [[] for _ in range(n + 1)]
for u, v, a, b in edges:
    graph[u].append((v, a, b))
    graph[v].append((u, a, b))

def dijkstra(s, pay):
    """
    s: start
    pay: 0 = yen, 1 = snuuk
    """
    d = [INF] * (n + 1)
    visited = [False] * (n + 1)
    pq = []

    heappush(pq, (0, s))
    d[s] = 0
    visited[s] = True

    while pq:
        cost, x = heappop(pq)
        visited[x] = True

        for v, *c in graph[x]:
            if visited[v]:
                continue

            if d[v] > d[x] + c[pay]:
                d[v] = d[x] + c[pay]
                heappush(pq, (d[v], v))

    return d

d1 = dijkstra(s, 0)
d2 = dijkstra(t, 1)

ans = []
tmp = float('inf')
for i in reversed(range(1, n + 1)):
    tmp = min(tmp, d1[i] + d2[i])
    ans.append(10 ** 15 - tmp)
    
print(*ans[::-1], sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappop, heappush
INF = float('inf')

n, m, s, t = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(m)]

def dijkstra(s, pay):
    """
    s: start
    pay: 0 = yen, 1 = snuuk
    """
    d = [INF] * (n + 1)
    visited = [False] * (n + 1)
    pq = []

    heappush(pq, (0, s))
    d[s] = 0
    visited[s] = True

    while pq:
        cost, x = heappop(pq)
        visited[x] = True

        if d[x] < cost:
            continue

        for u, v, *c in edges:
            if u != x and v != x:
                continue

            
            node = u if v == x else v
            if visited[node]:
                continue

            if d[node] > d[x] + c[pay]:
                d[node] = d[x] + c[pay]
                heappush(pq, (d[node], node))

    return d

d1 = dijkstra(s, 0)
d2 = dijkstra(t, 1)
cost = [v + w for v, w in zip(d1[1:], d2[1:])]

for i in range(n):
    print(10 ** 15 - min(cost[i:]))


Fixed submission:
from heapq import heappop, heappush
INF = float('inf')

n, m, s, t = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(m)]

graph = [[] for _ in range(n + 1)]
for u, v, a, b in edges:
    graph[u].append((v, a, b))
    graph[v].append((u, a, b))

def dijkstra(s, pay):
    """
    s: start
    pay: 0 = yen, 1 = snuuk
    """
    d = [INF] * (n + 1)
    visited = [False] * (n + 1)
    pq = []

    heappush(pq, (0, s))
    d[s] = 0
    visited[s] = True

    while pq:
        cost, x = heappop(pq)
        visited[x] = True

        for v, *c in graph[x]:
            if visited[v]:
                continue

            if d[v] > d[x] + c[pay]:
                d[v] = d[x] + c[pay]
                heappush(pq, (d[v], v))

    return d

d1 = dijkstra(s, 0)
d2 = dijkstra(t, 1)

ans = []
tmp = float('inf')
for i in reversed(range(1, n + 1)):
    tmp = min(tmp, d1[i] + d2[i])
    ans.append(10 ** 15 - tmp)
    
print(*ans[::-1], sep='\n')