Buggy python submission (verdict: Time Limit Exceeded):
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
import sys
input=sys.stdin.readline

def calc():
  n,m,s,t=map(int,input().split())
  s,t=s-1,t-1
  row=[]
  col=[]
  data1=[]
  data2=[]
  for _ in range(m):
    u,v,a,b=map(int,input().split())
    row.append(u-1)
    col.append(v-1)
    data1.append(a)
    data2.append(b)
  g1=csr_matrix((data1,(row,col)),shape=(n,n))
  g2=csr_matrix((data2,(row,col)),shape=(n,n))
  d1=dijkstra(g1,directed=False,indices=s)
  d2=dijkstra(g2,directed=False,indices=t)
  INF=10**15
  ans=[INF]*n
  ans[n-1]=int(d1[n-1]+d2[n-1])
  for i in range(n-2,-1,-1):
    tmp=int(d1[i]+d2[i])
    ans[i]=min(tmp,ans[i+1])
  for i in range(n):
    print(INF-ans[i])
calc()

Fixed submission:
import sys
input=sys.stdin.readline

import heapq

def dijkstra(s,edge):
    #始点sから各頂点への最短距離
    d = [float("inf")] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d

n,m,s,t=map(int,input().split())
s,t=s-1,t-1
edge1=[[] for _ in range(n)]
edge2=[[] for _ in range(n)]
for _ in range(m):
  u,v,a,b=map(int,input().split())
  edge1[u-1].append([a,v-1])
  edge1[v-1].append([a,u-1])
  edge2[u-1].append([b,v-1])
  edge2[v-1].append([b,u-1])
d1=dijkstra(s,edge1)
d2=dijkstra(t,edge2)
INF=10**15
ans=[INF]*n
ans[n-1]=int(d1[n-1]+d2[n-1])
for i in range(n-2,-1,-1):
  tmp=int(d1[i]+d2[i])
  ans[i]=min(tmp,ans[i+1])
for i in range(n):
  print(INF-ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

n,m,s,t=map(int,input().split())
s,t=s-1,t-1
edges=[list(map(int,input().split())) for _ in range(m)]
row=[]
col=[]
data1=[]
data2=[]
for u,v,a,b in edges:
  row.append(u-1)
  col.append(v-1)
  data1.append(a)
  data2.append(b)
g1=csr_matrix((data1,(row,col)),shape=(n,n))
g2=csr_matrix((data2,(row,col)),shape=(n,n))
d1=dijkstra(g1,directed=False,indices=s)
d2=dijkstra(g2,directed=False,indices=t)
ans=[10**18]*n
for i in range(n-1,-1,-1):
  tmp=int(d1[i])+int(d2[i])
  ans[i]=min(tmp,ans[i])
  if i!=n-1:
    ans[i]=min(ans[i],ans[i+1])
maxs=10**15
for i in range(n):
  print(maxs-ans[i])

Fixed submission:
import sys
input=sys.stdin.readline

import heapq

def dijkstra(s,edge):
    #始点sから各頂点への最短距離
    d = [float("inf")] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d

n,m,s,t=map(int,input().split())
s,t=s-1,t-1
edge1=[[] for _ in range(n)]
edge2=[[] for _ in range(n)]
for _ in range(m):
  u,v,a,b=map(int,input().split())
  edge1[u-1].append([a,v-1])
  edge1[v-1].append([a,u-1])
  edge2[u-1].append([b,v-1])
  edge2[v-1].append([b,u-1])
d1=dijkstra(s,edge1)
d2=dijkstra(t,edge2)
INF=10**15
ans=[INF]*n
ans[n-1]=int(d1[n-1]+d2[n-1])
for i in range(n-2,-1,-1):
  tmp=int(d1[i]+d2[i])
  ans[i]=min(tmp,ans[i+1])
for i in range(n):
  print(INF-ans[i])