use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let q: usize = input();
    let abcd: Vec<(usize, usize, usize, i64)> = (0..n - 1)
        .map(|_| (input(), input(), input(), input()))
        .collect();
    let xyuv: Vec<(usize, i64, usize, usize)> = (0..q)
        .map(|_| (input(), input(), input(), input()))
        .collect();

    let mut g = LowestCommonAncestor::new(n);
    let mut e = vec![vec![]; n];
    for (a, b, c, d) in abcd {
        let (a, b) = (a - 1, b - 1);
        e[a].push((b, c, d));
        e[b].push((a, c, d));
        g.add_edge(a, b, d);
    }
    g.init();

    let mut col = vec![(0, 0); n];
    let mut color = vec![std::collections::HashMap::new(); n];
    for i in 0..q {
        let (x, _, u, v) = xyuv[i];
        let (u, v) = (u - 1, v - 1);
        let c = g.lca(u, v);
        color[u].entry(x).or_insert((0, 0));
        color[v].entry(x).or_insert((0, 0));
        color[c].entry(x).or_insert((0, 0));
    }
    dfs(0, n, &e, &mut col, &mut color);

    for i in 0..q {
        let (x, y, u, v) = xyuv[i];
        let (u, v) = (u - 1, v - 1);
        let c = g.lca(u, v);
        let mut ans = g.dist[u] + g.dist[v] - 2 * g.dist[c];
        ans -= color[u][&x].1 + color[v][&x].1 - 2 * color[c][&x].1;
        ans += (color[u][&x].0 + color[v][&x].0 - 2 * color[c][&x].0) * y;
        println!("{}", ans);
    }
}

fn dfs(
    cur: usize,
    p: usize,
    e: &Vec<Vec<(usize, usize, i64)>>,
    now: &mut Vec<(i64, i64)>,
    color: &mut Vec<std::collections::HashMap<usize, (i64, i64)>>,
) {
    for (&c, col) in color[cur].iter_mut() {
        *col = now[c];
    }
    for &(next, c, d) in &e[cur] {
        if next != p {
            now[c].0 += 1;
            now[c].1 += d;
            dfs(next, cur, e, now, color);
            now[c].0 -= 1;
            now[c].1 -= d;
        }
    }
}

#[derive(Clone, Debug)]
struct LowestCommonAncestor<T> {
    n: usize,
    p: usize,
    edge: Vec<Vec<(usize, T)>>,
    depth: Vec<usize>,
    dist: Vec<T>,
    parent: Vec<Vec<usize>>,
}

impl<T: Clone + Copy + Default + std::ops::Add<Output = T>> LowestCommonAncestor<T> {
    fn new(n: usize) -> LowestCommonAncestor<T> {
        let mut p = 0;
        while (1 << p) < n {
            p += 1;
        }
        LowestCommonAncestor {
            n: n,
            p: p,
            edge: vec![vec![]; n],
            depth: vec![0; n],
            dist: vec![T::default(); n],
            parent: vec![vec![n; p]; n + 1],
        }
    }

    fn add_edge(&mut self, u: usize, v: usize, d: T) {
        self.edge[u].push((v, d));
        self.edge[v].push((u, d));
    }

    fn init(&mut self) {
        let n = self.n;
        self.dfs(0, 0, T::default(), n);
        for i in 0..self.p - 1 {
            for v in 0..self.n {
                let p = self.parent[self.parent[v][i]][i];
                self.parent[v][i + 1] = p;
            }
        }
    }

    fn dfs(&mut self, u: usize, d: usize, w: T, p: usize) {
        if p != self.n {
            self.parent[u][0] = p;
        }
        self.depth[u] = d;
        self.dist[u] = w;
        for i in 0..self.edge[u].len() {
            let (v, vw) = self.edge[u][i];
            if v != p {
                self.dfs(v, d + 1, w + vw, u);
            }
        }
    }

    fn lca(&self, u: usize, v: usize) -> usize {
        let mut u = u;
        let mut v = v;
        if self.depth[u] > self.depth[v] {
            let t = u;
            u = v;
            v = t;
        }
        let mut diff = self.depth[v] - self.depth[u];
        for i in (0..self.p).rev() {
            let d = 1 << i;
            if d <= diff {
                diff -= d;
                v = self.parent[v][i];
            }
        }
        for i in (0..self.p).rev() {
            let pu = self.parent[u][i];
            let pv = self.parent[v][i];
            if pu != pv {
                u = pu;
                v = pv;
            }
        }
        if u == v {
            u
        } else {
            self.parent[u][0]
        }
    }
}


Measured memory_bytes: 159356