object Main {
  import java.io.{BufferedReader, InputStream, InputStreamReader}
  import java.util.StringTokenizer
  import scala.reflect.ClassTag

  def main(args: Array[String]): Unit = {
    val out = new java.io.PrintWriter(System.out)
    new Main(out, new InputReader(System.in)).solve()
    out.flush()
  }

  private[this] val oj = System.getenv("ATCODER_DEBUG") == null
  @inline private final def DEBUG(f: => Unit): Unit = {
    if (!oj){ f }
  }
  @inline private final def debug(as: Array[Boolean]): Unit = if (!oj){ debug(as.map(x => if(x) "1" else "0").mkString) }
  @inline private final def debug(as: Array[Int]): Unit = if (!oj){ debug(as.mkString(" ")) }
  @inline private final def debug(as: Array[Long]): Unit =if (!oj){ debug(as.mkString(" ")) }
  @inline private final def debugDim(m: Array[Array[Long]]): Unit = if (!oj){
    REP(m.length) { i =>
      debug(m(i))
    }
  }
  @inline private final def debugDimFlip(m: Array[Array[Long]]): Unit = if (!oj){
    REP(m(0).length) { j =>
      REP(m.length) { i =>
        System.err.print(m(i)(j))
        System.err.print(" ")
      }
      System.err.println()
    }
  }
  @inline private final def debug(s: => String): Unit = DEBUG {
    System.err.println(s)
  }
  @inline private final def debugL(num: => Long): Unit = DEBUG {
    System.err.println(num)
  }
  private def isDebug[A](debug: => A, online: => A): A = {
    if (oj) online else debug
  }

  class InputReader(val stream: InputStream) {
    private[this] val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private[this] var tokenizer: StringTokenizer = _

    @inline private[this] final def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = Integer.parseInt(next())
    def nextLong(): Long = java.lang.Long.parseLong(next())
    def nextChar(): Char = next().charAt(0)

    def ni(): Int = nextInt()
    def nl(): Long = nextLong()
    def nc(): Char = nextChar()
    def ns(): String = next()
    def ns(n: Int): Array[Char] = ns().toCharArray
    def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
    def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
      val A1, A2 = Array.ofDim[Int](n)
      REP(n) { i =>
        A1(i) = ni() + offset
        A2(i) = ni() + offset
      }
      (A1, A2)
    }
    def nm(n: Int, m: Int): Array[Array[Int]] = {
      val A = Array.ofDim[Int](n, m)
      REP(n) { i =>
        REP(m) { j =>
          A(i)(j) = ni()
        }
      }
      A
    }
    def nal(n: Int): Array[Long] = map(n)(_ => nl())
    def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  }

  @inline private final def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  @inline private final def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }
  @inline private final def TO(from: Int, to: Int)(f: Int => Unit): Unit = {
    REP(to - from + 1, from)(f)
  }
  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }
  def cumSum(as: Array[Int]): Array[Long] = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}

object Workspace {
  case class Edge(to: Int, weight: Int, color: Int)
  case class Query(color: Int, y: Int, u: Int, v: Int)
  case class Queried(id: Int, color: Int, y: Int, co: Int)
//  case class QueryAns(cnt: Int, sum: Long)
}

class Main(out: java.io.PrintWriter, sc: Main.InputReader) {
  import sc._
  import Main._
  import java.util.Arrays.sort

  import scala.collection.mutable
  import math.{abs, max, min}
  import mutable.ArrayBuffer
  import Workspace._

  // toIntとか+7とかするならvalにしろ
  final private[this] val MOD = 1000000007

  /**
    * @return (depth, parent, queue)
    */
  def traceBfs(g: Array[ArrayBuffer[Edge]], rt: Int = 0): (Array[Int], Array[Int], Array[Int]) = {
    val n = g.length
    val INF = 1e9.toInt + 10
    val q, p = Array.ofDim[Int](n)
    q(0) = rt
    p(rt) = -1
    val d = Array.fill[Int](n)(INF)
    d(rt) = 0
    var cur = 0
    var last = 1
    while (cur < last) {
      val v = q(cur)
      REP(g(v).length) { i =>
        val u = g(v)(i).to
        if (d(u) == INF) {
          d(u) = d(v) + 1
          p(u) = v
          q(last) = u
          last += 1
        }
      }
      cur += 1
    }
    (d, p, q)
  }

  /**
    * Lowest Common Ancestor
    * @param g packで作ったグラフでおきかえること
    * @param K pow(2,K) >= N-1 なのか？ダブリングの深さ
    */
  class LCA(g: Array[ArrayBuffer[Edge]], N: Int, K: Int, rt: Int = 0){
    private[this] val ZERO = -1

    private[this] val (depth, parent, _) = traceBfs(g, rt)
    parent(rt) = rt // ルートを-1じゃなくてrtにする

    private[this] val anc = Array.ofDim[Int](K, N)
    REP(N) { i =>
      anc(0)(i) = parent(i)
    }
    REP(K - 1, 1) { k =>
      REP(N) { i =>
        anc(k)(i) = anc(k-1)(anc(k-1)(i))
      }
    }

    private def getParent(v: Int, k: Int, d: Int): Int = {
      if (d == 0) v
      else if (d % 2 == 1) getParent(anc(k)(v), k + 1, d / 2)
      else getParent(v, k + 1, d / 2)
    }

    /**
      * lca(v, ZERO) = v
      */
    def apply(v: Int, u: Int): Int = {
      def step(v0: Int, u0: Int, k: Int): Int = {
        if (k == -1) {
          anc(0)(v0) // １つ前の子を返したかったら(v0, u0)を返す
        } else if (anc(k)(v0) == anc(k)(u0)) {
          step(v0, u0, k - 1)
        } else {
          step(anc(k)(v0), anc(k)(u0), k - 1)
        }
      }

      if (v == ZERO) u
      else if (u == ZERO) v
      else {
        val d = min(depth(v), depth(u))
        val v0 = getParent(v, 0, depth(v) - d)
        val u0 = getParent(u, 0, depth(u) - d)
        if (v0 == u0) v0 // この時点で同じだったらダブリングで調べる必要がない
        else step(v0, u0, anc.length - 1)
      }
    }
  }

  def solve(): Unit = {
    val n, Q = ni()
    val g = Array.fill[ArrayBuffer[Edge]](n)(ArrayBuffer())
    REP(n - 1) { _ =>
      val a, b, color = ni() - 1
      val weight = ni()
      g(a) += Edge(b, weight, color)
      g(b) += Edge(a, weight, color)
    }

    val lca = new LCA(g, n, 17)

    val q = Array.ofDim[Query](Q)
    val queriedColor = Array.fill[ArrayBuffer[Queried]](n)(ArrayBuffer())
    REP(Q) { i =>
      val color = ni() - 1
      val y = ni()
      val u, v = ni() - 1
      q(i) = Query(color, y, u, v)
      queriedColor(u) += Queried(i, color, y, 1)
      queriedColor(v) += Queried(i, color, y, 1)
      queriedColor(lca(u, v)) += Queried(i, color, y, -2)
    }

    val dp = Array.ofDim[Long](n)
    val cnt = Array.ofDim[Int](n - 1)
    val sum = Array.ofDim[Long](n - 1)
    val queryDiff = Array.ofDim[Long](Q)
    def add(e: Edge): Unit = {
      cnt(e.color) += 1
      sum(e.color) += e.weight
    }

    def del(e: Edge): Unit = {
      cnt(e.color) -= 1
      sum(e.color) -= e.weight
    }

    def copyAns(v: Int): Unit = {
      val cs = queriedColor(v)
      REP(cs.length) { i =>
        val q = cs(i)
        val c = q.color
        queryDiff(q.id) += q.co * (cnt(c) * q.y - sum(c))
      }
    }

    def dfs(g: Array[ArrayBuffer[Edge]], rt: Int = 0) = {
      val n = g.length
      val stack = mutable.Stack[Edge]()
      val ix = Array.ofDim[Int](n)
      val parent = Array.ofDim[Int](n)
      parent(rt) = -1
      var p = 0

      p += 1
      stack.push(Edge(rt, 0, -1)) // 偽エッジ

      while(stack.nonEmpty) {
        val v = stack.top.to
        val es = g(v)
        if (ix(v) == 0) copyAns(v)

        if (ix(v) == es.length) {
          val back = stack.pop()
          if (back.to != rt) del(back)
        }
        else {
          val e = es(ix(v))
          if (e.to != parent(v)) {
            copyAns(v)
            add(e)
            dp(e.to) = dp(v) + e.weight
            parent(e.to) = v
            stack.push(e)
            p += 1
          }
          ix(v) += 1
        }
      }
    }

    dfs(g)
    REP(Q) { i =>
      val v = q(i).v
      val u = q(i).u
      val anc = lca(v, u)
      val base = dp(v) + dp(u) -dp(anc) * 2
//      val c = queryAns(v -> x).cnt + queryAns(u ->x).cnt - 2 * queryAns(anc ->x).cnt
//      val s = queryAns(v -> x).sum + queryAns(u ->x).sum - 2 * queryAns(anc ->x).sum
//      val diff = c * y - s
//      out.println(base + diff)
      out.println(base + queryDiff(i))
    }
  }
}