N,Q = gets.split.map &:to_i
cds = (0..N).map{ {} }
(N-1).times {
  a,b,c,d = gets.split.map &:to_i
  cds[a][b] = cds[b][a] = [c,d]
}

M = Math.sqrt(N).floor
$stderr.puts N, M
dtotal = Array.new(N+1,0)
td = 0
visited = { 1 => 1 }
queue = cds[1].map{ |n,_| [1,n] }.flatten
trail = [1]
lv = nil
lcatrail = Array.new(N+1,nil)
depth = Array.new(N+1,nil)
depth[1] = 0

tours = (0..N).map{ [] }
k = 0
kh = {}
while queue.size > 0 do
  n = queue.pop
  k += 1
  if !visited[n]
    #p "> #{n}"
    visited[n] = 1
    parent = queue[-1]
    c,d = cds[parent][n]
    #p parent, n, c,d
    td += d
    kh[n] = k
    tours[c] << [d,k]
    dtotal[n] = td
    cds[n].each{ |m,_|
      next if visited[m]
      queue << n; queue << m
    }
    i = 1
    ts = []
    while i <= trail.size do
      ts << trail[-i]
      i *= 2
    end
    lcatrail[n] = ts
    depth[n] = trail.size
    trail << n
    #p trail
  else
    #p "#{n} <"
    c,d = cds[lv][n]
    tours[c] << [-d,k]
    td -= d
    trail.pop
  end
  lv = n
end

stours = tours.map{ |ts|
  s = 0
  t = 0
  ss = [[0,s,t]]
  ts.map{ |r|
    d,n = r
    s += d
    t += (d > 0 ? 1 : -1)
    ss << [n,s,t]
  }
  ss.reverse
}

def hop(lcatrail, u, d)
  t = 0
  dd = d
  while d > 0 do
    t += 1
    ts = lcatrail[u]
    m = d.bit_length-1
    u = ts[m]
    d -= (1 << m)
  end
  #$stderr.puts "#{dd} #{t}"
  u
end

def lca(lcatrail, depth, u, v)
  d = depth[u] - depth[v]
  u2 = d > 0 ? hop(lcatrail, u, d) : u
  v2 = d < 0 ? hop(lcatrail, v,-d) : v
  #p [u,v,d,u2,v2]
  dd = depth[u2]
  t = 0
  while u2 != v2 do
    t += 1
    j = (0...lcatrail[u2].size).bsearch{ |i|
      lcatrail[u2][i] == lcatrail[v2][i]
    }
    return 1 if !j
    v2 = lcatrail[v2][j]
    u2 = lcatrail[u2][j]
  end
  #$stderr.puts "#{dd} #{t}"
  u2
end

def e_and_d(stours, kh, u, color)
  k = kh[u]
  r = if k
    ts = stours[color]
    kk,s,t = ts.bsearch{ |kk,s,t| k >= kk } || [0,0,0]
    [t,s]
  else
    [0,0]
  end
  #p [color,u,k,r]
  r
end

Q.times {
  x,y,u,v = gets.split.map &:to_i
  w = lca(lcatrail, depth, u, v)
  rs = [u,v,w].map{ |t| e_and_d(stours, kh, t, x) }
  xe = rs[0][0] + rs[1][0] - 2*rs[2][0]
  xd = rs[0][1] + rs[1][1] - 2*rs[2][1]
  td = dtotal[u] + dtotal[v] - 2*dtotal[w]
  p td - xd + xe*y
}
