local n, m = io.read("*n", "*n")
local s, t = io.read("*n", "*n")
local edge = {}
for i = 1, n do edge[i] = {} end
for i = 1, m do
  local u, v = io.read("*n", "*n")
  local a, b = io.read("*n", "*n")
  edge[u][v] = {a, b}
  edge[v][u] = {a, b}
end


local function getlength(start_idx, ci)
  local taskstate = {}
  for i = 1, n do taskstate[i] = false end
  local tasks = {}
  local tasknum = 0
  local done = 0

  local len = {}
  local inf = -1
  for i = 1, n do len[i] = inf end
  len[start_idx] = 0

  local function addtask(idx)
    if not taskstate[idx] then
      taskstate[idx] = true
      tasknum = tasknum + 1
      tasks[tasknum] = idx
    end
  end
  addtask(start_idx)

  while done < tasknum do
    local tmp = {}
    done = done + 1
    local src = tasks[done]
    taskstate[src] = false
    for dst, cost in pairs(edge[src]) do
      if len[dst] < 0 or len[src] + cost[ci] < len[dst] then
        len[dst] = len[src] + cost[ci]
        table.insert(tmp, dst)
      end
    end
    table.sort(tmp, function(a, b) return len[a] < len[b] end)
    for i = 1, #tmp do addtask(tmp[i]) end
  end
  return len
end

local yen = getlength(s, 1)
local snk = getlength(t, 2)
local ret = {}
for i = 1, n - 1 do ret[i] = 0 end
ret[n] = yen[n] + snk[n]
local mmi = math.min
for i = n - 1, 1, -1 do
  ret[i] = mmi(ret[i + 1], yen[i] + snk[i])
end
for i = 1, n do
  local a = 1000000000000000LL
  a = a - ret[i]
  local str = tostring(a):gsub("LL", "")
  print(str)
end
