use std::collections::{BTreeMap, BTreeSet, VecDeque};

const INF: u64 = 1 << 60;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let q: usize = sc.read();
    let mut graph = vec![vec![]; n];
    let mut simple = vec![vec![]; n];
    for _ in 1..n {
        let a = sc.read::<usize>() - 1;
        let b = sc.read::<usize>() - 1;
        let c = sc.read::<usize>() - 1;
        let d: u64 = sc.read();

        graph[a].push((b, c, d));
        graph[b].push((a, c, d));

        simple[a].push(b);
        simple[b].push(a);
    }

    let lca = lca::LowestCommonAncestor::new(&simple);
    let mut dist = vec![INF; n];
    dist[0] = 0;
    let mut queue = VecDeque::new();
    queue.push_back(0);
    while let Some(v) = queue.pop_front() {
        for &(next, _, cost) in graph[v].iter() {
            if dist[next] > dist[v] + cost {
                queue.push_back(next);
                dist[next] = dist[v] + cost;
            }
        }
    }

    let mut queries = vec![];
    let mut marker = vec![vec![]; n];
    for _ in 0..q {
        let c = sc.read::<usize>() - 1;
        let d: u64 = sc.read();
        let u = sc.read::<usize>() - 1;
        let v = sc.read::<usize>() - 1;
        let lca = lca.get_lca(u, v);
        marker[u].push(c);
        marker[v].push(c);
        marker[lca].push(c);

        queries.push((c, d, u, v, lca));
    }

    let mut color_count = vec![BTreeMap::new(); n];
    let mut color_dist = vec![BTreeMap::new(); n];

    euler_tour(
        0,
        0,
        &graph,
        &mut color_count,
        &mut color_dist,
        &mut vec![0; n],
        &mut vec![0; n],
        &marker,
    );
    for (c, d, u, v, lca) in queries.into_iter() {
        let total_dist = dist[u] + dist[v] - 2 * dist[lca];
        let color_dist = color_dist[u][&c] + color_dist[v][&c] - 2 * color_dist[lca][&c];
        let color_count = color_count[u][&c] + color_count[v][&c] - 2 * color_count[lca][&c];

        let ans = total_dist - color_dist + (color_count as u64) * d;
        sc.write(ans.to_string());
        sc.write("\n");
    }
}

fn euler_tour(
    v: usize,
    p: usize,
    graph: &Vec<Vec<(usize, usize, u64)>>,
    color_count: &mut Vec<BTreeMap<usize, usize>>,
    color_dist: &mut Vec<BTreeMap<usize, u64>>,
    cur_color_count: &mut Vec<usize>,
    cur_color_dist: &mut Vec<u64>,
    marker: &Vec<Vec<usize>>,
) {
    for &color in marker[v].iter() {
        color_count[v].insert(color, cur_color_count[color]);
        color_dist[v].insert(color, cur_color_dist[color]);
    }

    for &(next, color, cost) in graph[v].iter() {
        if next == p {
            continue;
        }
        cur_color_count[color] += 1;
        cur_color_dist[color] += cost;
        euler_tour(
            next,
            v,
            graph,
            color_count,
            color_dist,
            cur_color_count,
            cur_color_dist,
            marker,
        );
        cur_color_dist[color] -= cost;
        cur_color_count[color] -= 1;
    }
}

pub mod lca {
    const MAX_PARENT: usize = 1 << 50;
    pub struct LowestCommonAncestor {
        parent: Vec<Vec<usize>>,
        depth: Vec<usize>,
        log_v: usize,
    }

    impl LowestCommonAncestor {
        pub fn new(graph: &Vec<Vec<usize>>) -> Self {
            let num_v = graph.len();
            let root = 0;
            let mut depth = vec![0; num_v];

            let mut log_v = 1;
            let mut i = 1;
            while i <= num_v {
                i *= 2;
                log_v += 1;
            }
            let mut parent: Vec<Vec<usize>> = vec![vec![0; num_v]; log_v];

            let mut depth_vis = vec![false; num_v];
            let mut stack = ::std::collections::VecDeque::new();
            stack.push_front(root);
            parent[0][root] = MAX_PARENT;
            depth[root] = 0;
            depth_vis[root] = true;
            while !stack.is_empty() {
                let v = stack.pop_front().unwrap();
                stack.push_front(v);
                for &u in &graph[v] {
                    if depth_vis[u] {
                        continue;
                    }
                    parent[0][u] = v;
                    depth[u] = depth[v] + 1;
                    depth_vis[u] = true;
                    stack.push_front(u);
                }

                let head = stack.pop_front().unwrap();
                if head != v {
                    stack.push_front(head);
                }
            }

            for k in 0..(log_v - 1) {
                for u in 0..num_v {
                    parent[k + 1][u] = if parent[k][u] == MAX_PARENT {
                        MAX_PARENT
                    } else {
                        parent[k][parent[k][u]]
                    };
                }
            }

            LowestCommonAncestor {
                parent: parent,
                depth: depth,
                log_v: log_v,
            }
        }

        pub fn get_lca(&self, u: usize, v: usize) -> usize {
            let (mut u, mut v) = if self.depth[u] <= self.depth[v] {
                (u, v)
            } else {
                (v, u)
            };
            for k in 0..self.log_v {
                if ((self.depth[v] - self.depth[u]) & (1 << k)) != 0 {
                    v = self.parent[k][v];
                }
            }
            if u == v {
                return u;
            }

            for k in (0..self.log_v).rev() {
                if self.parent[k][u] != self.parent[k][v] {
                    u = self.parent[k][u];
                    v = self.parent[k][v];
                }
            }
            return self.parent[0][u];
        }

        pub fn get_dist(&self, u: usize, v: usize) -> usize {
            let lca = self.get_lca(u, v);
            self.depth[u] + self.depth[v] - self.depth[lca] * 2
        }
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 138744