// ---------- begin Lowest Common Ancestor ----------
struct LCA {
    n: usize,
    g: Vec<Vec<usize>>,
    size: Vec<usize>,
    index: Vec<usize>,
    path_root: Vec<usize>,
    path_parent: Vec<usize>,
}

impl LCA {
    pub fn new(n: usize) -> LCA {
        LCA {
            n: n,
            g: vec![vec![]; n],
            size: vec![],
            index: vec![],
            path_root: vec![],
            path_parent: vec![],
        }
    }
    pub fn add_edge(&mut self, a: usize, b: usize) {
        assert!(a < self.n && b < self.n);
        self.g[a].push(b);
        self.g[b].push(a);
    }
    pub fn build(&mut self, root: usize) {
        assert!(root < self.n);
        let mut stack = vec![];
        let mut q = vec![];
        stack.push((root, root));
        while let Some((v, p)) = stack.pop() {
            q.push(v);
            for i in 0..self.g[v].len() {
                if self.g[v][i] == p {
                    self.g[v].swap_remove(i);
                    break;
                }
            }
            for &u in &self.g[v] {
                stack.push((u, v));
            }
        }
        assert!(q.len() == self.n);
        self.size = vec![1; self.n];
        for &v in q.iter().rev() {
            for &u in &self.g[v] {
                self.size[v] += self.size[u];
            }
        }
        self.index = vec![0; self.n];
        self.path_root = vec![root; self.n];
        self.path_parent = vec![root; self.n];
        self.dfs(root, &mut 0);
    }
    fn dfs(&mut self, v: usize, k: &mut usize) {
        self.index[v] = *k;
        *k += 1;
        if self.g[v].len() == 0 {
            return;
        }
        for i in 1..self.g[v].len() {
            if self.size[self.g[v][0]] < self.size[self.g[v][i]] {
                self.g[v].swap(0, i);
            }
        }
        let u = self.g[v][0];
        self.path_root[u] = self.path_root[v];
        self.path_parent[u] = self.path_parent[v];
        self.dfs(u, k);
        for i in 1..self.g[v].len() {
            let u = self.g[v][i];
            self.path_root[u] = u;
            self.path_parent[u] = v;
            self.dfs(u, k);
        }
    }
    fn query(&self, mut a: usize, mut b: usize) -> usize {
        let path = &self.path_root;
        let parent = &self.path_parent;
        let index = &self.index;
        while path[a] != path[b] {
            if index[a] < index[b] {
                b = parent[b];
            } else {
                a = parent[a];
            }
        }
        if index[a] < index[b] {a} else {b}
    }
}
// ---------- end Lowest Common Ancestor ----------
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

use std::io::Write;

fn run() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    input! {
        n: usize,
        q: usize,
        e: [(usize1, usize1, usize1, u32); n - 1],
        ask: [(usize1, u32, usize1, usize1); q],
    }
    let mut g = vec![vec![]; n];
    let mut lca = LCA::new(n);
    for &(a, b, c, d) in &e {
        g[a].push((b, c, d));
        g[b].push((a, c, d));
        lca.add_edge(a, b);
    }
    lca.build(0);
    let mut eval = vec![vec![]; n];
    for &(x, y, u, v) in &ask {
        eval[u].push((x, y));
        eval[v].push((x, y));
        eval[lca.query(u, v)].push((x, y));
    }
    enum Operation {
        ADD(usize, u32),
        SUB(usize, u32),
        DFS(usize, usize),
    }
    let mut sum = vec![0; n];
    let mut cnt = vec![0; n];
    let mut sum_all = 0;
    let mut memo = std::collections::BTreeMap::<(usize, usize, u32), u32>::new();
    let mut stack = vec![Operation::DFS(0, 0)];
    while let Some(op) = stack.pop() {
        match op {
            Operation::ADD(c, w) => {
                sum[c] += w;
                cnt[c] += 1;
                sum_all += w;
            },
            Operation::SUB(c, w) => {
                sum[c] -= w;
                cnt[c] -= 1;
                sum_all -= w;
            },
            Operation::DFS(v, p) => {
                for &(c, d) in &eval[v] {
                    let ans = sum_all - sum[c] + cnt[c] * d;
                    memo.insert((v, c, d), ans);
                }
                for &(u, c, d) in &g[v] {
                    if u == p {
                        continue;
                    }
                    stack.push(Operation::SUB(c, d));
                    stack.push(Operation::DFS(u, v));
                    stack.push(Operation::ADD(c, d));
                }
            },
        }
    }
    for (x, y, u, v) in ask {
        let mut ans = 0;
        ans += *memo.get(&(u, x, y)).unwrap();
        ans += *memo.get(&(v, x, y)).unwrap();
        ans -= 2 * *memo.get(&(lca.query(u, v), x, y)).unwrap();
        writeln!(out, "{}", ans).ok();
    }
}

fn main() {
    run();
}


Measured memory_bytes: 80888